wires 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wires/channel.rb +26 -14
  3. data/lib/wires/hub.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe770b52bcfa8f3d4ebd9cdbc9474495cf518d40
4
- data.tar.gz: 504f5acec60a51e872a21e01730f0e624e6ce0af
3
+ metadata.gz: 8ba5a18e82d8030466a788523b4cf1a35444a7ee
4
+ data.tar.gz: 358f486714e9b7b2d91103966a08c6591d6b4b88
5
5
  SHA512:
6
- metadata.gz: 1e2e093f083689a43817e88ca3eec0dd013d513eb072c2f95b4fa98131c23748e61f19830dbe949d8560e91c706a069859f5813d256ed793295bba039bfbb96f
7
- data.tar.gz: 2bfa6a3d6fe622e208ea61b41ae7dc40ca6ed3bb20dba0c07a4eab0e916301f1a4a13e760eb89857079f57e524c3794d25f5ea07196d047df053522152542f28
6
+ metadata.gz: d04c8d15e06683af78f41167c30443209063ff38561229006ad2d35e94cfb924c570daee44344092e95b81dc9515399f10509fdfdaea5d00dc3ea1375ed4a564
7
+ data.tar.gz: ee87a782456ba1f9cd1572edda652cde60e7e4d66e1721e59e21fe8eb660b043f5f2bdd0f90c8bf1b3f68665196c3271906528d55715bc07c563b73892f0f87e
@@ -95,23 +95,35 @@ module Wires
95
95
 
96
96
  def relevant_channels
97
97
  return @@channel_hash[hub].values if self==channel_star
98
-
99
- if self.name.is_a?(Regexp) then raise TypeError,
100
- "Cannot fire on Regexp channel: #{self.name}."\
101
- " Regexp channels can only used in event handlers." end
102
98
 
103
99
  relevant = [channel_star]
104
- for c in @@channel_hash[hub].values
105
- relevant << c if \
106
- if c.name.is_a?(Regexp)
107
- self.name =~ c.name
108
- elsif (defined?(c.name.channel_name) and
109
- defined?(self.name.channel_name))
110
- self.name.channel_name == c.name.channel_name
111
- else
112
- self.name.to_s == c.name.to_s
113
- end
100
+ my_names = (self.name.is_a? Array) ? self.name : [self.name]
101
+ my_names.map {|o| (o.respond_to? :channel_name) ? o.channel_name : o.to_s}
102
+ .flatten(1)
103
+
104
+ for my_name in my_names
105
+
106
+ if my_name.is_a?(Regexp) then raise TypeError,
107
+ "Cannot fire on Regexp channel: #{self.name}."\
108
+ " Regexp channels can only used in event handlers." end
109
+
110
+ for other_chan in @@channel_hash[hub].values
111
+
112
+ other_name = other_chan.name
113
+ other_name = (other_name.respond_to? :channel_name) ? \
114
+ other_name.channel_name : other_name
115
+
116
+ relevant << other_chan if \
117
+ if other_name.is_a?(Regexp)
118
+ my_name =~ other_name
119
+ else
120
+ my_name.to_s == other_name.to_s
121
+ end
122
+
123
+ end
124
+
114
125
  end
126
+
115
127
  return relevant.uniq
116
128
  end
117
129
 
@@ -12,7 +12,7 @@ module Wires
12
12
  private
13
13
 
14
14
  # Make subclasses call class_init
15
- def inherited(subcls); subcls.class_init end
15
+ def inherited(subcls); subcls.send(:class_init) end
16
16
 
17
17
  # Moved to a dedicated method for subclass' sake
18
18
  def class_init
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wires
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-14 00:00:00.000000000 Z
11
+ date: 2013-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport