Class: WipeOut::Callback
- Inherits:
-
Object
- Object
- WipeOut::Callback
- Defined in:
- lib/wipe_out/callback.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, block) ⇒ Callback
constructor
A new instance of Callback.
- #run(execution) ⇒ Object
Constructor Details
#initialize(name, block) ⇒ Callback
Returns a new instance of Callback.
5 6 7 8 |
# File 'lib/wipe_out/callback.rb', line 5 def initialize(name, block) @name = name.to_sym @block = block end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/wipe_out/callback.rb', line 3 def name @name end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 19 |
# File 'lib/wipe_out/callback.rb', line 16 def ==(other) name == other.name && block == other.block end |
#run(execution) ⇒ Object
10 11 12 13 14 |
# File 'lib/wipe_out/callback.rb', line 10 def run(execution) raise("Wrong arity for callback name=#{name}") if block.arity != 1 block.call(execution) end |