Class: Thimble::QueueItem

Inherits:
Object
  • Object
show all
Defined in:
lib/queue_item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(item, name = 'Item') ⇒ QueueItem

Returns a new instance of QueueItem.



8
9
10
11
12
# File 'lib/queue_item.rb', line 8

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

#idObject (readonly)

Returns the value of attribute id.



6
7
8
# File 'lib/queue_item.rb', line 6

def id
  @id
end

#itemObject (readonly)

Returns the value of attribute item.



6
7
8
# File 'lib/queue_item.rb', line 6

def item
  @item
end

Instance Method Details

#to_sObject



14
15
16
# File 'lib/queue_item.rb', line 14

def to_s
  "#{@name}: #{@item} ID: #{@id}"
end