Class: CptHook::DSL::MethodCall
- Inherits:
-
Object
- Object
- CptHook::DSL::MethodCall
- Defined in:
- lib/cpt_hook/dsl/method_call.rb
Instance Attribute Summary collapse
-
#contexts ⇒ Object
readonly
Returns the value of attribute contexts.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#withs ⇒ Object
readonly
Returns the value of attribute withs.
Instance Method Summary collapse
- #clone(other) ⇒ Object
- #dup ⇒ Object
-
#initialize(method_to_call) ⇒ MethodCall
constructor
A new instance of MethodCall.
- #resolve_contexts(&block) ⇒ Object
- #resolve_with(&block) ⇒ Object
- #using(*args) ⇒ Object
- #with(*args) ⇒ Object
Constructor Details
#initialize(method_to_call) ⇒ MethodCall
Returns a new instance of MethodCall.
6 7 8 9 10 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 6 def initialize(method_to_call) @method = method_to_call @contexts = [] @withs = [] end |
Instance Attribute Details
#contexts ⇒ Object (readonly)
Returns the value of attribute contexts.
4 5 6 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 4 def contexts @contexts end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 4 def method @method end |
#withs ⇒ Object (readonly)
Returns the value of attribute withs.
4 5 6 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 4 def withs @withs end |
Instance Method Details
#clone(other) ⇒ Object
28 29 30 31 32 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 28 def clone(other) @withs = other.withs.dup @contexts = other.contexts.dup self end |
#dup ⇒ Object
34 35 36 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 34 def dup MethodCall.new(@method).clone(self) end |
#resolve_contexts(&block) ⇒ Object
16 17 18 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 16 def resolve_contexts(&block) @contexts.map!(&block) end |
#resolve_with(&block) ⇒ Object
12 13 14 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 12 def resolve_with(&block) @withs.map!(&block) end |
#using(*args) ⇒ Object
24 25 26 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 24 def using(*args) @contexts = args end |
#with(*args) ⇒ Object
20 21 22 |
# File 'lib/cpt_hook/dsl/method_call.rb', line 20 def with(*args) @withs = args end |