Class: Caffeinate::OptionEvaluator

Inherits:
Object
  • Object
show all
Defined in:
lib/caffeinate/schedule_evaluator.rb

Instance Method Summary collapse

Constructor Details

#initialize(thing, drip, mailing) ⇒ OptionEvaluator

Returns a new instance of OptionEvaluator.



3
4
5
6
7
# File 'lib/caffeinate/schedule_evaluator.rb', line 3

def initialize(thing, drip, mailing)
  @thing = thing
  @drip = drip
  @mailing = mailing
end

Instance Method Details

#callObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/caffeinate/schedule_evaluator.rb', line 9

def call
  if @thing.is_a?(Symbol)
    @drip.dripper.new.send(@thing, @drip, @mailing)
  elsif @thing.is_a?(Proc)
    @mailing.instance_exec(&@thing)
  elsif @thing.is_a?(String)
    Time.parse(@thing)
  else
    @thing
  end
end