Class: Ribs::MetaData
- Inherits:
-
Object
- Object
- Ribs::MetaData
- Defined in:
- lib/ribs/definition.rb
Overview
Collects all the meta data about a specific Ribs model
Instance Attribute Summary collapse
-
#identity_map ⇒ Object
Should this object be saved in an identity map?.
-
#persistent_class ⇒ Object
The persistent class that Hibernate uses as a definition for this model.
-
#rib ⇒ Object
The Rib that defines all the mapping data.
-
#table ⇒ Object
The table to connect to.
Instance Method Summary collapse
-
#[](name) ⇒ Object
Return the property instance for the given
name. -
#identity_map? ⇒ Boolean
Should this object be saved in an identity map?.
-
#properties ⇒ Object
Return all the properties for this model.
-
#properties_and_identity ⇒ Object
Return all the properties for this model.
Instance Attribute Details
#identity_map ⇒ Object
Should this object be saved in an identity map?
48 49 50 |
# File 'lib/ribs/definition.rb', line 48 def identity_map @identity_map end |
#persistent_class ⇒ Object
The persistent class that Hibernate uses as a definition for this model.
44 45 46 |
# File 'lib/ribs/definition.rb', line 44 def persistent_class @persistent_class end |
#rib ⇒ Object
The Rib that defines all the mapping data
46 47 48 |
# File 'lib/ribs/definition.rb', line 46 def rib @rib end |
#table ⇒ Object
The table to connect to
41 42 43 |
# File 'lib/ribs/definition.rb', line 41 def table @table end |
Instance Method Details
#[](name) ⇒ Object
Return the property instance for the given name.
56 57 58 |
# File 'lib/ribs/definition.rb', line 56 def [](name) self.persistent_class.get_property(name.to_s) rescue nil end |
#identity_map? ⇒ Boolean
Should this object be saved in an identity map?
51 52 53 |
# File 'lib/ribs/definition.rb', line 51 def identity_map? self.identity_map end |
#properties ⇒ Object
Return all the properties for this model.
61 62 63 64 65 66 67 68 |
# File 'lib/ribs/definition.rb', line 61 def properties self.persistent_class.property_iterator.to_a.inject({}) do |h, value| if !value.respond_to?(:getRubyValue) h[value.name] = value end h end end |
#properties_and_identity ⇒ Object
Return all the properties for this model.
71 72 73 74 75 76 77 78 |
# File 'lib/ribs/definition.rb', line 71 def properties_and_identity (self.persistent_class.property_iterator.to_a + [self.persistent_class.identifier_property]).inject({}) do |h, value| if !value.respond_to?(:getRubyValue) h[value.name] = value end h end end |