Class: Stock::Holder

Inherits:
Ohm::Model
  • Object
show all
Includes:
Ohm::FindAdditions
Defined in:
lib/porp/stock/holder.rb

Overview

The StockHolder class represents holders of stock, such as outlets, stock rooms, warehouses, etc.

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) ensure_extant(holders)

Ensure that a holder object corresponding to each passed string or symbol exists, creating it if not

Parameters:

  • holders

    Collection of strings or symbols corresponding to names of holders



31
32
33
34
# File 'lib/porp/stock/holder.rb', line 31

def self.ensure_extant(holders)
  holders = [holders] unless holders.kind_of?(Array)
  holders.each {|name| find_or_create(name: name)}
end

Instance Method Details

- (Object) validate



22
23
24
# File 'lib/porp/stock/holder.rb', line 22

def validate
  assert_unique :name
end