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(**kwargs) ⇒ Item

Returns a new instance of Item.



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

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

Dynamic Method Handling

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

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