on 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/on/version.rb +1 -1
  2. data/lib/on.rb +5 -0
  3. data/test/on_test.rb +7 -0
  4. metadata +4 -4
data/lib/on/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class On
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/on.rb CHANGED
@@ -49,6 +49,11 @@ class On
49
49
  end
50
50
  end
51
51
 
52
+ # Returns a list of supported callback names provided in the initializer.
53
+ def callbacks
54
+ @callbacks.to_a
55
+ end
56
+
52
57
  # Represents a callback called with its +name+ and +args+.
53
58
  class Callback < Struct.new(:name, :args)
54
59
  end
data/test/on_test.rb CHANGED
@@ -24,6 +24,13 @@ class OnTest < Testem
24
24
  called.clear
25
25
  end
26
26
 
27
+ test "returns a list of supported callback names" do
28
+ on = On.new(:success, :failure) {}
29
+ assert_equal 2, on.callbacks.size
30
+ assert on.callbacks.include?(:success)
31
+ assert on.callbacks.include?(:failure)
32
+ end
33
+
27
34
  test "calls callback w/o args" do
28
35
  on = On.new(:success) do |callback|
29
36
  called! :block
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 'on'
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-29 00:00:00.000000000 Z
12
+ date: 2012-12-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: 3260149224139585846
113
+ hash: -2576027221997955073
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements:
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  version: '0'
120
120
  segments:
121
121
  - 0
122
- hash: 3260149224139585846
122
+ hash: -2576027221997955073
123
123
  requirements: []
124
124
  rubyforge_project:
125
125
  rubygems_version: 1.8.24