Class: Qs::Job
Direct Known Subclasses
Constant Summary collapse
- PAYLOAD_TYPE =
'job'
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Message
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, options = nil) ⇒ Job
constructor
A new instance of Job.
- #inspect ⇒ Object
- #route_name ⇒ Object
Methods inherited from Message
Constructor Details
#initialize(name, options = nil) ⇒ Job
Returns a new instance of Job.
11 12 13 14 15 16 17 18 |
# File 'lib/qs/job.rb', line 11 def initialize(name, = nil) ||= {} [:params] ||= {} validate!(name, [:params]) @name = name @created_at = [:created_at] || Time.now super(PAYLOAD_TYPE, ) end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
9 10 11 |
# File 'lib/qs/job.rb', line 9 def created_at @created_at end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/qs/job.rb', line 9 def name @name end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# 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 ⇒ Object
24 25 26 27 28 29 30 |
# 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 ⇒ Object
20 21 22 |
# File 'lib/qs/job.rb', line 20 def route_name self.name end |