Class: Invokr::Invocation
- Inherits:
-
Struct
- Object
- Struct
- Invokr::Invocation
- Defined in:
- lib/invokr/invocation.rb
Instance Attribute Summary collapse
-
#block_arg ⇒ Object
Returns the value of attribute block_arg.
-
#keyword_args ⇒ Object
Returns the value of attribute keyword_args.
-
#method ⇒ Object
Returns the value of attribute method.
-
#positional_args ⇒ Object
Returns the value of attribute positional_args.
Instance Method Summary collapse
Instance Attribute Details
#block_arg ⇒ Object
Returns the value of attribute block_arg
2 3 4 |
# File 'lib/invokr/invocation.rb', line 2 def block_arg @block_arg end |
#keyword_args ⇒ Object
Returns the value of attribute keyword_args
2 3 4 |
# File 'lib/invokr/invocation.rb', line 2 def keyword_args @keyword_args end |
#method ⇒ Object
Returns the value of attribute method
2 3 4 |
# File 'lib/invokr/invocation.rb', line 2 def method @method end |
#positional_args ⇒ Object
Returns the value of attribute positional_args
2 3 4 |
# File 'lib/invokr/invocation.rb', line 2 def positional_args @positional_args end |
Instance Method Details
#args ⇒ Object
15 16 17 18 19 |
# File 'lib/invokr/invocation.rb', line 15 def args args = positional_args.dup args << keyword_args unless keyword_args.empty? args end |
#block_arg? ⇒ Boolean
11 12 13 |
# File 'lib/invokr/invocation.rb', line 11 def block_arg? block_arg ? true : false end |
#invoke!(obj) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/invokr/invocation.rb', line 3 def invoke! obj if block_arg? obj.public_send method, *args, &block_arg else obj.public_send method, *args end end |