class Kicker::Job

Attributes

command[RW]
exit_code[RW]
output[RW]

Public Class Methods

attr_with_default(name, merge_hash = false, &default) click to toggle source
# File lib/kicker/job.rb, line 3
def self.attr_with_default(name, merge_hash = false, &default)
  # If `nil` this returns the `default`, unless explicitely set to `nil` by
  # the user.
  define_method(name) do
    if instance_variable_get("@#{name}_assigned")
      if assigned_value = instance_variable_get("@#{name}")
        merge_hash ? instance_eval(&default).merge(assigned_value) : assigned_value
      end
    else
      instance_eval(&default)
    end
  end
  define_method("#{name}=") do |value|
    instance_variable_set("@#{name}_assigned", true)
    instance_variable_set("@#{name}", value)
  end
end
new(attributes) click to toggle source
# File lib/kicker/job.rb, line 23
def initialize(attributes)
  @exit_code = 0
  @output = ''
  attributes.each { |k,v| send("#{k}=", v) }
end

Public Instance Methods

success?() click to toggle source
# File lib/kicker/job.rb, line 29
def success?
  exit_code == 0
end