travis-ci
9 of 9 new or added lines in 1 file covered. (100.0%)
507 of 514 relevant lines covered (98.64%)
52.82 hits per line
1 |
module Wisper |
6✔ |
2 |
class Registration |
6✔ |
3 |
attr_reader :on, :listener |
6✔ |
4 |
|
|
5 |
def initialize(listener, options) |
6✔ |
6 |
@listener = listener
|
687✔ |
7 |
@on = Array(options.fetch(:on) { 'all' }).map(&:to_s) |
1,149✔ |
8 |
end
|
|
9 |
|
|
|
def listener |
6✔ |
|
case @listener |
852✔ |
|
when Class |
291 only jruby-19mode, rbx, and jruby-20mode ✔ |
|
clazz = Kernel.const_get(@listener.to_s) |
× |
|
clazz.new |
× |
|
when String |
291 only jruby-19mode, rbx, and jruby-20mode ✔ |
|
clazz = Kernel.const_get(@listener) |
× |
|
clazz.new |
187 only rbx ✔ |
18 |
else
|
|
|
@listener
|
852✔ |
20 |
end
|
|
21 |
end
|
|
22 |
|
|
23 |
private |
6✔ |
24 |
|
|
25 |
def should_broadcast?(event) |
6✔ |
26 |
on.include?(event) || on.include?('all')
|
340✔ |
27 |
end
|
|
28 |
end
|
|
29 |
end
|