Module: GOM::Object

Defined in:
lib/gom/object.rb

Defined Under Namespace

Classes: Builder, CachedBuilder, Collection, Draft, Id, Inspector, Mapping, Proxy

Class Method Summary collapse

Class Method Details

.id(object) ⇒ Object



13
14
15
16
# File 'lib/gom/object.rb', line 13

def self.id(object)
  id = Mapping.id_by_object object
  id ? id.to_s : nil
end

.reference(value) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/gom/object.rb', line 23

def self.reference(value)
  if value.is_a?(GOM::Object::Proxy)
    value
  elsif value.is_a?(String)
    Proxy.new Id.new(value)
  else
    Proxy.new value
  end
end

.storage_name(object) ⇒ Object



18
19
20
21
# File 'lib/gom/object.rb', line 18

def self.storage_name(object)
  id = Mapping.id_by_object object
  id ? id.storage_name : nil
end