Module: AttrPouch::ClassMethods

Defined in:
lib/attr_pouch.rb

Instance Method Summary collapse

Instance Method Details

#pouch(field, &block) ⇒ Object



381
382
383
384
385
386
387
388
389
390
# File 'lib/attr_pouch.rb', line 381

def pouch(field, &block)
  if block_given?
    pouch = Pouch.new(self, field)
    @pouches ||= {}
    @pouches[field] = pouch
    pouch.instance_eval(&block)
  else
    @pouches[field]
  end
end