Class: Jamef::Item

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/jamef/item.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width = nil, height = nil, length = nil, quantity = nil, weight = nil, price = nil) ⇒ Item

Returns a new instance of Item.



9
10
11
12
13
14
15
16
# File 'lib/jamef/item.rb', line 9

def initialize(width=nil, height=nil, length=nil, quantity=nil, weight=nil, price=nil)
  @width = width
  @height = height
  @length = length
  @quantity = quantity
  @weight = weight
  @price = price
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



7
8
9
# File 'lib/jamef/item.rb', line 7

def height
  @height
end

#lengthObject

Returns the value of attribute length.



7
8
9
# File 'lib/jamef/item.rb', line 7

def length
  @length
end

#priceObject

Returns the value of attribute price.



7
8
9
# File 'lib/jamef/item.rb', line 7

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



7
8
9
# File 'lib/jamef/item.rb', line 7

def quantity
  @quantity
end

#weightObject

Returns the value of attribute weight.



7
8
9
# File 'lib/jamef/item.rb', line 7

def weight
  @weight
end

#widthObject

Returns the value of attribute width.



7
8
9
# File 'lib/jamef/item.rb', line 7

def width
  @width
end

Instance Method Details

#cubageObject



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

def cubage
  Elegible.new('*', self.width, self.height, self.length, self.quantity).total
end