evt-virtual 0.1.0.2 → 0.1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 04c077de2af76907cad8943ab38d020d5e3f04b6
4
- data.tar.gz: 383ad9cca5685b3ee9e3b54f8e24487cac1a42d8
2
+ SHA256:
3
+ metadata.gz: 1044d9a76ab3791cd6a9453e3f1c11b62134e873080b827f1ce2173edad7eb91
4
+ data.tar.gz: 5a133a6740bb3166a8a107e9d948f749e7e015eb497345a45afd6fcd584d0d6d
5
5
  SHA512:
6
- metadata.gz: bb0810f4ad76812a861c79b3f0594deb33e8e1292ec01a870dec206da8e666e4094e5f84a8395673f8e6da6a9701647fafde329e5062bc1a51e912d074c1069a
7
- data.tar.gz: ea2bf0885b95d8a69e8363c85ee0066d61e739fba7b4232b6e8e362c9b76add8590a9fe5c13bea20450ad23982d20ecc2235121752e30d172faa78b2ddc1ea4f
6
+ metadata.gz: 53c9359bbae22d1d3d9b44f5ad48529fb73004a615227c36bb5cc1850dead0b83421b447c8e41068f8bd861f1a05825b185fe384eba9f2d2370f84c1baaa7f5e
7
+ data.tar.gz: 9467cceabc33a7063cb2be68715b9edc91194d26cd8c8c228cc0fad8a3e41fc894410f9470527332a26767714e92d7c9b1fa437ddc1d0fa31299eb433eb27342
@@ -2,3 +2,4 @@ require 'virtual/method'
2
2
  require 'virtual/pure_method'
3
3
  require 'virtual/macro'
4
4
  require 'virtual/activate'
5
+ require 'virtual/virtual'
@@ -2,8 +2,26 @@ module Virtual
2
2
  def self.activate(target_class=nil)
3
3
  target_class ||= Object
4
4
 
5
- return if target_class.ancestors.include? Virtual::Macro
5
+ return if target_class.ancestors.include?(Virtual::Macro)
6
6
 
7
- target_class.extend Virtual::Macro
7
+ target_class.extend(Virtual::Macro)
8
+ end
9
+
10
+ module Assertions
11
+ def activated?
12
+ subject = Assertions.subject_class(self)
13
+
14
+ ['virtual', 'pure_virtual', 'abstract'].each do |mthd|
15
+ fail mthd unless subject.respond_to?(mthd)
16
+ end
17
+ end
18
+
19
+ def self.subject_class(subject)
20
+ if [Module, Class].include?(subject)
21
+ return subject
22
+ else
23
+ return subject.class
24
+ end
25
+ end
8
26
  end
9
27
  end
@@ -0,0 +1,6 @@
1
+ require 'virtual/controls/clean'
2
+ require 'virtual/controls/included'
3
+ require 'virtual/controls/extended'
4
+ require 'virtual/controls/virtual_method'
5
+ require 'virtual/controls/pure_virtual_method'
6
+ require 'virtual/controls/abstract_method'
@@ -0,0 +1,16 @@
1
+ module Virtual
2
+ module Controls
3
+ module AbstractMethod
4
+ class Example
5
+ include Virtual
6
+
7
+ pure_virtual :some_pure_virtual_method
8
+ end
9
+
10
+ def self.example
11
+ Example.new
12
+ end
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,13 @@
1
+ module Virtual
2
+ module Controls
3
+ module Clean
4
+ class Example
5
+ end
6
+
7
+ def self.example
8
+ Example.new
9
+ end
10
+ end
11
+ end
12
+ end
13
+
@@ -0,0 +1,14 @@
1
+ module Virtual
2
+ module Controls
3
+ module Extended
4
+ class Example
5
+ extend Virtual
6
+ end
7
+
8
+ def self.example
9
+ Example.new
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,14 @@
1
+ module Virtual
2
+ module Controls
3
+ module Included
4
+ class Example
5
+ include Virtual
6
+ end
7
+
8
+ def self.example
9
+ Example.new
10
+ end
11
+ end
12
+ end
13
+ end
14
+
@@ -0,0 +1,27 @@
1
+ module Virtual
2
+ module Controls
3
+ module PureVirtualMethod
4
+ class Example
5
+ include Virtual
6
+
7
+ pure_virtual :some_pure_virtual_method
8
+ end
9
+
10
+ def self.example
11
+ Example.new
12
+ end
13
+
14
+ module Implemented
15
+ class Implementer < Example
16
+ def some_pure_virtual_method
17
+ end
18
+ end
19
+
20
+ def self.example
21
+ Implementer.new
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+
@@ -0,0 +1,30 @@
1
+ module Virtual
2
+ module Controls
3
+ module VirtualMethod
4
+ class Example
5
+ include Virtual
6
+
7
+ virtual :some_virtual_method
8
+ end
9
+
10
+ def self.example
11
+ Example.new
12
+ end
13
+
14
+ module Body
15
+ class Example
16
+ include Virtual
17
+
18
+ virtual :some_virtual_method do |*|
19
+ :something
20
+ end
21
+ end
22
+
23
+ def self.example
24
+ Example.new
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+
@@ -1,14 +1,14 @@
1
1
  module Virtual
2
- class PureMethodError < RuntimeError
3
- def initialize(message)
4
- super("Pure virtual (abstract) method #{message} must be implemented")
2
+ module PureMethod
3
+ class Error < RuntimeError
4
+ def initialize(message)
5
+ super("Pure virtual (abstract) method #{message} must be implemented")
6
+ end
5
7
  end
6
- end
7
8
 
8
- module PureMethod
9
9
  def self.define(target_class, method_name)
10
10
  target_class.send :define_method, method_name do |*args|
11
- raise PureMethodError, "\"#{method_name}\" of #{target_class.name}"
11
+ raise Error, "\"#{method_name}\" of #{target_class.name}"
12
12
  end
13
13
  end
14
14
  end
@@ -0,0 +1,9 @@
1
+ module Virtual
2
+ def self.included(cls)
3
+ activate(cls)
4
+ end
5
+
6
+ def self.extended(cls)
7
+ activate(cls)
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evt-virtual
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.2
4
+ version: 0.1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Eventide Project
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-01 00:00:00.000000000 Z
11
+ date: 2018-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test_bench
@@ -32,9 +32,17 @@ extra_rdoc_files: []
32
32
  files:
33
33
  - lib/virtual.rb
34
34
  - lib/virtual/activate.rb
35
+ - lib/virtual/controls.rb
36
+ - lib/virtual/controls/abstract_method.rb
37
+ - lib/virtual/controls/clean.rb
38
+ - lib/virtual/controls/extended.rb
39
+ - lib/virtual/controls/included.rb
40
+ - lib/virtual/controls/pure_virtual_method.rb
41
+ - lib/virtual/controls/virtual_method.rb
35
42
  - lib/virtual/macro.rb
36
43
  - lib/virtual/method.rb
37
44
  - lib/virtual/pure_method.rb
45
+ - lib/virtual/virtual.rb
38
46
  homepage: https://github.com/eventide-project/virtual
39
47
  licenses:
40
48
  - MIT
@@ -55,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
63
  version: '0'
56
64
  requirements: []
57
65
  rubyforge_project:
58
- rubygems_version: 2.6.11
66
+ rubygems_version: 2.7.3
59
67
  signing_key:
60
68
  specification_version: 4
61
69
  summary: Virtual method declaration