Class: SerialScheduler::Dsl::CallWrapper

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(callee, meth) ⇒ CallWrapper

Returns a new instance of CallWrapper.



5
6
7
8
# File 'lib/serial_scheduler/dsl.rb', line 5

def initialize(callee, meth)
  @callee = callee
  @meth = meth
end

Instance Attribute Details

#calleeObject (readonly)

Returns the value of attribute callee.



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

def callee
  @callee
end

#methObject (readonly)

Returns the value of attribute meth.



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

def meth
  @meth
end

Instance Method Details

#callObject



10
11
12
13
# File 'lib/serial_scheduler/dsl.rb', line 10

def call
  instance_to_call = callee.kind_of?(String) ? callee.constantize : callee
  instance_to_call.send(meth)
end

#to_sObject



15
16
17
# File 'lib/serial_scheduler/dsl.rb', line 15

def to_s
  "#{callee}.#{meth}"
end