Class: QueueItem
- Inherits:
-
Object
- Object
- QueueItem
- Defined in:
- lib/QueueItem.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#item ⇒ Object
readonly
Returns the value of attribute item.
Instance Method Summary collapse
-
#initialize(item, name = "Item") ⇒ QueueItem
constructor
A new instance of QueueItem.
- #to_s ⇒ Object
Constructor Details
#initialize(item, name = "Item") ⇒ QueueItem
4 5 6 7 8 |
# File 'lib/QueueItem.rb', line 4 def initialize(item, name= "Item") @id = Digest::SHA256.digest(rand(10**100).to_s + Time.now.to_i.to_s) @item = item @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/QueueItem.rb', line 3 def id @id end |
#item ⇒ Object (readonly)
Returns the value of attribute item.
3 4 5 |
# File 'lib/QueueItem.rb', line 3 def item @item end |
Instance Method Details
#to_s ⇒ Object
10 11 12 |
# File 'lib/QueueItem.rb', line 10 def to_s "#{@name}: #{@item} \nID: #{@id}" end |