Class: AD::Framework::StructuralClass
- Inherits:
-
Object
- Object
- AD::Framework::StructuralClass
- Includes:
- Patterns::Callbacks, Patterns::HasSchema, Patterns::Persistence, Patterns::Searchable, Patterns::Validations
- Defined in:
- lib/ad-framework/structural_class.rb
Instance Attribute Summary collapse
-
#fields ⇒ Object
Returns the value of attribute fields.
-
#meta_class ⇒ Object
Returns the value of attribute meta_class.
Class Method Summary collapse
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(attributes = {}) ⇒ StructuralClass
constructor
A new instance of StructuralClass.
- #inspect ⇒ Object
- #treebase ⇒ Object
- #treebase=(new_value) ⇒ Object
Methods included from Patterns::Validations
Methods included from Patterns::Callbacks
Methods included from Patterns::Searchable
Methods included from Patterns::Persistence
Methods included from Patterns::HasSchema
Constructor Details
#initialize(attributes = {}) ⇒ StructuralClass
Returns a new instance of StructuralClass.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ad-framework/structural_class.rb', line 20 def initialize(attributes = {}) self. = class << self; self; end self.fields = AD::Framework::Fields.new(attributes.delete(:fields) || {}) if (treebase = (attributes.delete(:treebase) || attributes.delete("treebase"))) self.treebase = treebase end self.attributes = attributes end |
Instance Attribute Details
#fields ⇒ Object
Returns the value of attribute fields.
18 19 20 |
# File 'lib/ad-framework/structural_class.rb', line 18 def fields @fields end |
#meta_class ⇒ Object
Returns the value of attribute meta_class.
18 19 20 |
# File 'lib/ad-framework/structural_class.rb', line 18 def @meta_class end |
Class Method Details
.connection ⇒ Object
52 53 54 |
# File 'lib/ad-framework/structural_class.rb', line 52 def connection AD::Framework.connection end |
Instance Method Details
#connection ⇒ Object
38 39 40 |
# File 'lib/ad-framework/structural_class.rb', line 38 def connection self.class.connection end |
#inspect ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/ad-framework/structural_class.rb', line 42 def inspect (attr_display = self.attributes.collect do |(name, value)| "#{name}: #{value.inspect}" end) attr_display << "treebase: #{self.treebase.inspect}" [ "#<#{self.class} ", attr_display.sort.join(", "), ">" ].join end |
#treebase ⇒ Object
31 32 33 |
# File 'lib/ad-framework/structural_class.rb', line 31 def treebase self.schema.treebase end |
#treebase=(new_value) ⇒ Object
34 35 36 |
# File 'lib/ad-framework/structural_class.rb', line 34 def treebase=(new_value) self.schema.treebase = new_value end |