Class: Jamef::Cubage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ Cubage

Returns a new instance of Cubage.



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

def initialize(items)
  @items = items.kind_of?(Array) ? items : [items]
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



4
5
6
# File 'lib/jamef/cubage.rb', line 4

def items
  @items
end

Instance Method Details

#priceObject



18
19
20
# File 'lib/jamef/cubage.rb', line 18

def price
  Elegible.new('+', price_sum)
end

#to_sObject



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

def to_s
  Elegible.new('+', cubage_sum).to_s
end

#totalObject



10
11
12
# File 'lib/jamef/cubage.rb', line 10

def total
  Elegible.new('+', cubage_sum).total 
end

#weightObject



22
23
24
# File 'lib/jamef/cubage.rb', line 22

def weight
  Elegible.new('+', weight_sum)
end