Class: ActionHandler::Call
- Inherits:
-
Object
- Object
- ActionHandler::Call
- Defined in:
- lib/action_handler/call.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
Instance Method Summary collapse
-
#==(other) ⇒ Object
overrides.
- #call_with(receiver) ⇒ Object
-
#hash ⇒ Object
overrides.
-
#initialize(method_name, args = []) ⇒ Call
constructor
A new instance of Call.
Constructor Details
#initialize(method_name, args = []) ⇒ Call
Returns a new instance of Call.
8 9 10 11 12 13 |
# File 'lib/action_handler/call.rb', line 8 def initialize(method_name, args = []) raise ArgumentError, 'args must be an array' unless args.is_a?(Array) @method_name = method_name.to_sym @args = args.freeze end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/action_handler/call.rb', line 6 def args @args end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
5 6 7 |
# File 'lib/action_handler/call.rb', line 5 def method_name @method_name end |
Instance Method Details
#==(other) ⇒ Object
overrides
20 21 22 23 24 |
# File 'lib/action_handler/call.rb', line 20 def ==(other) other.is_a?(ActionHandler::Call) && method_name == other.method_name && args == other.args end |
#call_with(receiver) ⇒ Object
15 16 17 |
# File 'lib/action_handler/call.rb', line 15 def call_with(receiver) receiver.send(method_name, *args) end |
#hash ⇒ Object
overrides
27 28 29 |
# File 'lib/action_handler/call.rb', line 27 def hash [method_name, args].hash end |