wires 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/wires/base/channel.rb +17 -1
- data/lib/wires/base/event.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b75245c516a29082cbc30499aa0ccdb1a66e4a06
|
4
|
+
data.tar.gz: 82267cb4a27d04f8fce823f29a4a85767fe3be4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba93a9b65347f9c547ae977fc331665cd8f977290cbfa75b38a3945f6c27acf54938bf074301bfe10e856e559fc8a9cb72ff99f3aa9ed2b05fbd8f74d36fee18
|
7
|
+
data.tar.gz: 3df28faff0f05f21b1ffdfaa08dfaa8d5f8cb2f9689bd2501d31db886bd946b1006fde807afbba0b0c0f017d81319e0e326e86d229a5eec11d53546a2847eedf
|
data/lib/wires/base/channel.rb
CHANGED
@@ -7,7 +7,7 @@ module Wires
|
|
7
7
|
attr_reader :handlers
|
8
8
|
attr_accessor :not_firable
|
9
9
|
|
10
|
-
def inspect; "#{self.class}
|
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
|
|
data/lib/wires/base/event.rb
CHANGED
@@ -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}
|
16
|
+
"#{the_type}[#{list}]"
|
17
17
|
end
|
18
18
|
|
19
19
|
# Internalize all *args and **kwargs and &block to be accessed later
|