class Qs::Job
Constants
- InvalidError
- PAYLOAD_TYPE
Attributes
created_at[R]
name[R]
Public Class Methods
new(name, options = nil)
click to toggle source
Calls superclass method
# File lib/qs/job.rb, line 11 def initialize(name, options = nil) options ||= {} options[:params] ||= {} validate!(name, options[:params]) @name = name @created_at = options[:created_at] || Time.now super(PAYLOAD_TYPE, options) end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
# File lib/qs/job.rb, line 32 def ==(other) if other.kind_of?(self.class) self.payload_type == other.payload_type && self.name == other.name && self.params == other.params && self.created_at == other.created_at else super end end
inspect()
click to toggle source
# File lib/qs/job.rb, line 24 def inspect reference = '0x0%x' % (self.object_id << 1) "#<#{self.class}:#{reference} " \ "@name=#{self.name.inspect} " \ "@params=#{self.params.inspect} " \ "@created_at=#{self.created_at.inspect}>" end
route_name()
click to toggle source
# File lib/qs/job.rb, line 20 def route_name self.name end
Private Instance Methods
validate!(name, params)
click to toggle source
# File lib/qs/job.rb, line 45 def validate!(name, params) problem = if name.to_s.empty? "The job doesn't have a name." elsif !params.kind_of?(::Hash) "The job's params are not valid." end raise(InvalidError, problem) if problem end