Class: Kit::Bit::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/kit/models/bit.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Job



17
18
19
20
21
22
23
24
25
26
# File 'lib/kit/models/bit.rb', line 17

def initialize *args
  if args[0].is_a? Hash
    hash = args[0]
    args = [ hash[:config_file], hash[:bit_id], hash[:action], *hash[:args] ]
  end
  @config_file = args[0]
  @bit_id      = args[1]
  @action      = args[2]
  @args        = *args[3..-1]
end

Instance Method Details

#performObject



28
29
30
31
# File 'lib/kit/models/bit.rb', line 28

def perform
  Kit.open @config_file
  Kit::Bit.find(@bit_id).send(@action, *@args)
end