Class: Makers::Maker
- Inherits:
-
Object
- Object
- Makers::Maker
- Defined in:
- lib/makers/maker.rb
Instance Attribute Summary collapse
-
#assignments ⇒ Object
readonly
Returns the value of attribute assignments.
-
#associations ⇒ Object
readonly
Returns the value of attribute associations.
-
#disabled_association ⇒ Object
Returns the value of attribute disabled_association.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#sequences ⇒ Object
readonly
Returns the value of attribute sequences.
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(name, model, assignments, associations, sequences, options) ⇒ Maker
constructor
A new instance of Maker.
Constructor Details
#initialize(name, model, assignments, associations, sequences, options) ⇒ Maker
Returns a new instance of Maker.
7 8 9 10 11 12 13 14 |
# File 'lib/makers/maker.rb', line 7 def initialize(name, model, assignments, associations, sequences, ) @name = name @model = model @assignments = assignments @associations = associations @sequences = sequences @options = end |
Instance Attribute Details
#assignments ⇒ Object (readonly)
Returns the value of attribute assignments.
4 5 6 |
# File 'lib/makers/maker.rb', line 4 def assignments @assignments end |
#associations ⇒ Object (readonly)
Returns the value of attribute associations.
4 5 6 |
# File 'lib/makers/maker.rb', line 4 def associations @associations end |
#disabled_association ⇒ Object
Returns the value of attribute disabled_association.
5 6 7 |
# File 'lib/makers/maker.rb', line 5 def disabled_association @disabled_association end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
4 5 6 |
# File 'lib/makers/maker.rb', line 4 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/makers/maker.rb', line 4 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/makers/maker.rb', line 4 def @options end |
#sequences ⇒ Object (readonly)
Returns the value of attribute sequences.
4 5 6 |
# File 'lib/makers/maker.rb', line 4 def sequences @sequences end |
Instance Method Details
#attributes ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/makers/maker.rb', line 32 def attributes all = assignments.dup if .has_key?(:parent) all.reverse_merge! Makers.definitions.find([:parent]).assignments end if disabled_association associations.each do |name, class_name| if disabled_association == class_name all[name] = -> { nil } end end end object = Object.new all.each do |name, block| object.define_singleton_method name, &block end hash = {} all.keys.each do |name| hash[name] = object.send(name) end hash end |