Module: Delineate::Resolve

Extended by:
ActiveSupport::Concern
Included in:
AttributeMap
Defined in:
lib/delineate/resolve.rb

Instance Method Summary collapse

Instance Method Details

#resolve(must_resolve = false, resolving = []) ⇒ Object

Attempts to resolve this map and the maps it depends on, including declared associations, and returns success status as a boolean. If the must_resolve parameter is truthy, raises raise an exception if the map cannot be fully resolved.



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/delineate/resolve.rb', line 20

def resolve(must_resolve = false, resolving = [])
  return true if @resolved
  return true if resolving.include?(@klass_name)    # prevent infinite recursion

  resolving.push(@klass_name)

  result = resolve_associations(must_resolve, resolving)
  result = false unless resolve_sti_baseclass(must_resolve, resolving)

  resolving.pop
  @resolved = result
end

#resolve!Object

Attempts to resolve this map and the maps it depends on, including declared associations. Will raise an exception if the map cannot be fully resolved.



12
13
14
15
# File 'lib/delineate/resolve.rb', line 12

def resolve!
  resolve(:must_resolve)
  self
end

#resolved?Boolean

Returns true if this map is fully resolved

Returns:

  • (Boolean)


6
7
8
# File 'lib/delineate/resolve.rb', line 6

def resolved?
  @resolved
end