Class: Physical::Item

Inherits:
Cuboid
  • Object
show all
Defined in:
lib/physical/item.rb

Constant Summary collapse

DEFAULT_LENGTH =
0

Instance Attribute Summary collapse

Attributes inherited from Cuboid

#dimensions, #height, #id, #length, #properties, #weight, #width

Instance Method Summary collapse

Methods inherited from Cuboid

#==, #density, #volume

Constructor Details

#initialize(cost: nil, sku: nil, description: nil, **kwargs) ⇒ Item

Returns a new instance of Item.



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

def initialize(cost: nil, sku: nil, description: nil, **kwargs)
  @cost = Types::Money.optional[cost]
  @sku = sku
  @description = description
  super kwargs
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Physical::Cuboid

Instance Attribute Details

#costObject (readonly)

Returns the value of attribute cost.



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

def cost
  @cost
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#skuObject (readonly)

Returns the value of attribute sku.



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

def sku
  @sku
end