Class: Evoc::Tx

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/evoc/tx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index: nil, id:, date: nil, items:) ⇒ Tx

Returns a new instance of Tx.



7
8
9
10
11
12
# File 'lib/evoc/tx.rb', line 7

def initialize(index: nil,id:,date: nil,items:)
  @index = index
  @id    = id
  @date  = date
  @items = items
end

Instance Attribute Details

#dateObject (readonly)

Returns the value of attribute date.



4
5
6
# File 'lib/evoc/tx.rb', line 4

def date
  @date
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/evoc/tx.rb', line 4

def id
  @id
end

#indexObject

Returns the value of attribute index.



5
6
7
# File 'lib/evoc/tx.rb', line 5

def index
  @index
end

#itemsObject

Returns the value of attribute items.



5
6
7
# File 'lib/evoc/tx.rb', line 5

def items
  @items
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
# File 'lib/evoc/tx.rb', line 18

def <=> other
  self.index <=> other.index
end

#sizeObject



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

def size
  self.items.size
end

#to_aObject



30
31
32
# File 'lib/evoc/tx.rb', line 30

def to_a
  self.items.to_a
end

#to_iObject



22
23
24
# File 'lib/evoc/tx.rb', line 22

def to_i
  self.index.to_i
end

#to_sObject



26
27
28
# File 'lib/evoc/tx.rb', line 26

def to_s
  self.id.to_s
end