evt-virtual 0.1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 07c05f4aeb72844d1b5d2a4c2f18a30f96e12d26
4
+ data.tar.gz: 8680d43eb0b564b1a05ef7c1fd417992a0cec795
5
+ SHA512:
6
+ metadata.gz: b9fc1b9c9ed9c4ed4b7b629deba9f32ceeed0326ef6db3374d2c1cd78102a387e81cd0f35ada4d845c55913a08ed13614406c47311379d19ced4673732475af9
7
+ data.tar.gz: 47b854a4092997cc037ee9e6ee0391d7e83106e96dae1306957c9736c4dbb452577767b44463788b1b886550394cce0f0cc3a29d59b718263a415c64562db8fe
@@ -0,0 +1,4 @@
1
+ require 'virtual/method'
2
+ require 'virtual/pure_method'
3
+ require 'virtual/macro'
4
+ require 'virtual/activate'
@@ -0,0 +1,9 @@
1
+ module Virtual
2
+ def self.activate(target_class=nil)
3
+ target_class ||= Object
4
+
5
+ return if target_class.ancestors.include? Virtual::Macro
6
+
7
+ target_class.extend Virtual::Macro
8
+ end
9
+ end
@@ -0,0 +1,14 @@
1
+ module Virtual
2
+ module Macro
3
+ def virtual_macro(method_name, &blk)
4
+ Virtual::Method.define self, method_name, &blk
5
+ end
6
+ alias :virtual :virtual_macro
7
+
8
+ def pure_macro(method_name)
9
+ Virtual::PureMethod.define self, method_name
10
+ end
11
+ alias :pure_virtual :pure_macro
12
+ alias :abstract :pure_macro
13
+ end
14
+ end
@@ -0,0 +1,10 @@
1
+ module Virtual
2
+ module Method
3
+ def self.define(target_class, method_name, &blk)
4
+ blk ||= proc do |*|
5
+ end
6
+
7
+ target_class.send :define_method, method_name, &blk
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ module Virtual
2
+ class PureMethodError < RuntimeError
3
+ def initialize(message)
4
+ super("Pure virtual (abstract) method #{message} must be implemented")
5
+ end
6
+ end
7
+
8
+ module PureMethod
9
+ def self.define(target_class, method_name)
10
+ target_class.send :define_method, method_name do |*args|
11
+ raise PureMethodError, "\"#{method_name}\" of #{target_class.name}"
12
+ end
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: evt-virtual
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - The Eventide Project
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ntl-test_bench
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: " "
28
+ email: opensource@eventide-project.org
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/virtual.rb
34
+ - lib/virtual/activate.rb
35
+ - lib/virtual/macro.rb
36
+ - lib/virtual/method.rb
37
+ - lib/virtual/pure_method.rb
38
+ homepage: https://github.com/eventide-project/virtual
39
+ licenses:
40
+ - MIT
41
+ metadata: {}
42
+ post_install_message:
43
+ rdoc_options: []
44
+ require_paths:
45
+ - lib
46
+ required_ruby_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 2.3.3
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ requirements: []
57
+ rubyforge_project:
58
+ rubygems_version: 2.5.2
59
+ signing_key:
60
+ specification_version: 4
61
+ summary: Virtual method declaration
62
+ test_files: []