Class: Ribs::MetaData

Inherits:
Object
  • Object
show all
Defined in:
lib/ribs/definition.rb

Overview

Collects all the meta data about a specific Ribs model

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#identity_mapObject

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_classObject

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

#ribObject

The Rib that defines all the mapping data



46
47
48
# File 'lib/ribs/definition.rb', line 46

def rib
  @rib
end

#tableObject

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?

Returns:

  • (Boolean)


51
52
53
# File 'lib/ribs/definition.rb', line 51

def identity_map?
  self.identity_map
end

#propertiesObject

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_identityObject

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