Class: Opensteam::InventoryBase::Inventory

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/opensteam/inventory_base.rb

Overview

Inventory Model

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define_property_accessorsObject

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

Returns:

  • (Boolean)


58
# File 'lib/opensteam/inventory_base.rb', line 58

def is_active?() active == 1 ; end

#is_available?Boolean

checks if inventory-object is available

Returns:

  • (Boolean)


61
# File 'lib/opensteam/inventory_base.rb', line 61

def is_available?() storage > 0 && is_active? ; end