wires 0.5.0 → 0.5.1

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
2
  SHA1:
3
- metadata.gz: 04ad9bc6ef2ce9a54aad3343c13fca6ca69f1895
4
- data.tar.gz: cf519182f4a9cd03776cb749d3bd922aeb5add3a
3
+ metadata.gz: b75245c516a29082cbc30499aa0ccdb1a66e4a06
4
+ data.tar.gz: 82267cb4a27d04f8fce823f29a4a85767fe3be4b
5
5
  SHA512:
6
- metadata.gz: 435a2df3af44aa3bd5b00a3f37d7abb273cb9be65276bfb717441b64bed14bb38b2b7bbc9044c60708b66db168799172319da9ef317bfb7ac0873d23ef3a9b15
7
- data.tar.gz: b753ee2f1123be7b186f59ea37bfab07ba20d737e9fde3ec931d1cbe2cefc616d1149b4021da73b010210b81a4d3987b9dc9b424cdd39444909d2de3a53cea40
6
+ metadata.gz: ba93a9b65347f9c547ae977fc331665cd8f977290cbfa75b38a3945f6c27acf54938bf074301bfe10e856e559fc8a9cb72ff99f3aa9ed2b05fbd8f74d36fee18
7
+ data.tar.gz: 3df28faff0f05f21b1ffdfaa08dfaa8d5f8cb2f9689bd2501d31db886bd946b1006fde807afbba0b0c0f017d81319e0e326e86d229a5eec11d53546a2847eedf
@@ -7,7 +7,7 @@ module Wires
7
7
  attr_reader :handlers
8
8
  attr_accessor :not_firable
9
9
 
10
- def inspect; "#{self.class}(#{name.inspect})"; end
10
+ def inspect; "#{self.class}[#{name.inspect}]"; end
11
11
 
12
12
  @hub = Hub
13
13
  @router = Router::Default
@@ -46,6 +46,22 @@ module Wires
46
46
  unless @handlers.include? [events, proc]
47
47
  end
48
48
 
49
+ # Insert the @registered_channels variable into the proc
50
+ channels = proc.instance_variable_get(:@registered_channels)
51
+ if channels
52
+ channels << self
53
+ else
54
+ proc.instance_variable_set(:@registered_channels, [self])
55
+ end
56
+
57
+ # Insert the #unregister method into the proc
58
+ proc.singleton_class.send :define_method, :unregister do
59
+ singleton_class.send :remove_method, :unregister
60
+ @registered_channels.each do |c|
61
+ c.unregister self
62
+ end
63
+ end unless proc.respond_to? :unregister
64
+
49
65
  proc
50
66
  end
51
67
 
@@ -9,11 +9,11 @@ module Wires
9
9
 
10
10
  # Return a friendly output upon inspection
11
11
  def inspect
12
- list = [*args, **kwargs]
12
+ list = kwargs.empty? ? [*args] : [*args, **kwargs]
13
13
  list << codeblock.to_s if codeblock
14
14
  list = list.map(&:inspect).join ', '
15
15
  the_type = type ? type.inspect : ''
16
- "#{the_type}:[#{list}]"
16
+ "#{the_type}[#{list}]"
17
17
  end
18
18
 
19
19
  # Internalize all *args and **kwargs and &block to be accessed later
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wires
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain