Module: ToyModel::Attributes

Defined in:
lib/toy-model/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute(value) ⇒ Object



6
7
8
9
10
# File 'lib/toy-model/attributes.rb', line 6

def attribute value
  wrapper = ToyModel::AttributeWrapper.new value, self
  self.toy_attributes << wrapper
  wrapper
end

#attributesObject



16
17
18
# File 'lib/toy-model/attributes.rb', line 16

def attributes
  toy_attributes.select{|a| a.parent == self}
end

#attrs(*args) ⇒ Object



12
13
14
# File 'lib/toy-model/attributes.rb', line 12

def attrs *args
  ToyModel::AttributesCollection.new self, *args
end

#use_toy_model?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/toy-model/attributes.rb', line 20

def use_toy_model?
  true
end