spnet 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/spnet/block.rb +6 -6
- data/lib/spnet/control_message.rb +1 -1
- data/lib/spnet/message.rb +2 -2
- data/lib/spnet/message_in_port.rb +3 -3
- data/lib/spnet/message_out_port.rb +1 -1
- data/lib/spnet/signal_in_port.rb +2 -2
- data/lib/spnet/signal_out_port.rb +1 -1
- data/lib/spnet/version.rb +1 -1
- data/spnet.gemspec +1 -1
- metadata +7 -7
data/lib/spnet/block.rb
CHANGED
@@ -8,12 +8,12 @@ class Block
|
|
8
8
|
DO_NOTHING = ->(){}
|
9
9
|
|
10
10
|
HASHED_ARG_SPECS = [
|
11
|
-
Hashmake::
|
12
|
-
Hashmake::
|
13
|
-
Hashmake::
|
14
|
-
Hashmake::
|
15
|
-
Hashmake::
|
16
|
-
Hashmake::
|
11
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :name, :type => String, :default => "UNNAMED"),
|
12
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :algorithm, :type => Proc, :default => DO_NOTHING),
|
13
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :signal_in_ports, :type => SignalInPort, :array => true, :default => ->(){ Array.new } ),
|
14
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :signal_out_ports, :type => SignalOutPort, :array => true, :default => ->(){ Array.new }),
|
15
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :message_in_ports, :type => MessageInPort, :array => true, :default => ->(){ Array.new }),
|
16
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :message_out_ports, :type => MessageOutPort, :array => true, :default => ->(){ Array.new })
|
17
17
|
]
|
18
18
|
|
19
19
|
def initialize args = {}
|
@@ -14,7 +14,7 @@ class ControlMessage < Message
|
|
14
14
|
]
|
15
15
|
|
16
16
|
HASHED_ARGS_SPECS = [
|
17
|
-
Hashmake::
|
17
|
+
Hashmake::ArgSpec.new(:reqd => true, :key => :subtype, :type => Symbol, :validator => ->(a){ SUBTYPES.include?(a) } )
|
18
18
|
]
|
19
19
|
|
20
20
|
attr_reader :subtype
|
data/lib/spnet/message.rb
CHANGED
@@ -11,8 +11,8 @@ class Message
|
|
11
11
|
TYPES = [ CONTROL, COMMAND ]
|
12
12
|
|
13
13
|
HASHED_ARGS_SPECS = [
|
14
|
-
Hashmake::
|
15
|
-
Hashmake::
|
14
|
+
Hashmake::ArgSpec.new(:reqd => true, :key => :type, :type => Symbol, :validator => ->(a){ TYPES.include?(a) } ),
|
15
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :data, :type => Object, :default => nil),
|
16
16
|
]
|
17
17
|
|
18
18
|
attr_accessor :data
|
@@ -7,9 +7,9 @@ class MessageInPort
|
|
7
7
|
DEFAULT_VALIDATOR = ->(a){ true }
|
8
8
|
|
9
9
|
ARG_SPECS = [
|
10
|
-
Hashmake::
|
11
|
-
Hashmake::
|
12
|
-
Hashmake::
|
10
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :name, :type => String, :default => "UNNAMED"),
|
11
|
+
Hashmake::ArgSpec.new(:reqd => true, :key => :processor, :type => Proc),
|
12
|
+
Hashmake::ArgSpec.new(:reqd => true, :key => :message_type, :type => Symbol, :validator => ->(a){ Message::TYPES.include?(a) })
|
13
13
|
]
|
14
14
|
|
15
15
|
attr_reader :name, :link
|
@@ -6,7 +6,7 @@ class MessageOutPort
|
|
6
6
|
include Hashmake::HashMakeable
|
7
7
|
|
8
8
|
ARG_SPECS = [
|
9
|
-
Hashmake::
|
9
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :name, :type => String, :default => "UNNAMED"),
|
10
10
|
]
|
11
11
|
|
12
12
|
attr_reader :name, :links
|
data/lib/spnet/signal_in_port.rb
CHANGED
@@ -7,8 +7,8 @@ class SignalInPort
|
|
7
7
|
DEFAULT_LIMITS = (-Float::MAX..Float::MAX)
|
8
8
|
|
9
9
|
ARG_SPECS = [
|
10
|
-
Hashmake::
|
11
|
-
Hashmake::
|
10
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :name, :type => String, :default => "UNNAMED"),
|
11
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :limits, :type => Range, :default => DEFAULT_LIMITS)
|
12
12
|
]
|
13
13
|
|
14
14
|
attr_reader :name, :limits, :link, :queue
|
@@ -6,7 +6,7 @@ class SignalOutPort
|
|
6
6
|
include Hashmake::HashMakeable
|
7
7
|
|
8
8
|
ARG_SPECS = [
|
9
|
-
Hashmake::
|
9
|
+
Hashmake::ArgSpec.new(:reqd => false, :key => :name, :type => String, :default => "UNNAMED"),
|
10
10
|
]
|
11
11
|
|
12
12
|
attr_reader :name, :links
|
data/lib/spnet/version.rb
CHANGED
data/spnet.gemspec
CHANGED
@@ -19,7 +19,7 @@ DESCRIPTION
|
|
19
19
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
20
20
|
gem.require_paths = ['lib']
|
21
21
|
|
22
|
-
gem.add_dependency 'hashmake'
|
22
|
+
gem.add_dependency 'hashmake', '~> 0.1.1'
|
23
23
|
|
24
24
|
gem.add_development_dependency 'bundler', '~> 1.0'
|
25
25
|
gem.add_development_dependency 'rake', '~> 0.8'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spnet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -16,17 +16,17 @@ dependencies:
|
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 0.1.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: bundler
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
segments:
|
161
161
|
- 0
|
162
|
-
hash: -
|
162
|
+
hash: -47610687
|
163
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
164
|
none: false
|
165
165
|
requirements:
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
segments:
|
170
170
|
- 0
|
171
|
-
hash: -
|
171
|
+
hash: -47610687
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
174
|
rubygems_version: 1.8.23
|