Class: Opensteam::InventoryBase::Inventory
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Opensteam::InventoryBase::Inventory
- Defined in:
- lib/opensteam/inventory_base.rb
Overview
Inventory Model
Class Method Summary collapse
-
.define_property_accessors ⇒ Object
define property accessor methods, like “Inventory.find(:first).colors”.
Instance Method Summary collapse
-
#is_active? ⇒ Boolean
check if inventory-object is active.
-
#is_available? ⇒ Boolean
checks if inventory-object is available.
Class Method Details
.define_property_accessors ⇒ Object
define property accessor methods, like “Inventory.find(:first).colors”
48 49 50 51 52 53 54 |
# File 'lib/opensteam/inventory_base.rb', line 48 def self.define_property_accessors Opensteam::Base::PropertyBase.properties.each do |accessor| self.class_eval do define_method( accessor.tableize ) { accessor.classify.constantize.find(:all) } end end end |
Instance Method Details
#is_active? ⇒ Boolean
check if inventory-object is active
58 |
# File 'lib/opensteam/inventory_base.rb', line 58 def is_active?() active == 1 ; end |
#is_available? ⇒ Boolean
checks if inventory-object is available
61 |
# File 'lib/opensteam/inventory_base.rb', line 61 def is_available?() storage > 0 && is_active? ; end |