Class: CptHook::DSL::MethodCall

Inherits:
Object
  • Object
show all
Defined in:
lib/cpt_hook/dsl/method_call.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contextsObject (readonly)

Returns the value of attribute contexts.



4
5
6
# File 'lib/cpt_hook/dsl/method_call.rb', line 4

def contexts
  @contexts
end

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/cpt_hook/dsl/method_call.rb', line 4

def method
  @method
end

#withsObject (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

#dupObject



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