Method: Oraora::Meta#find

Defined in:
lib/oraora/meta.rb

#find(context) ⇒ Object

Returns a node identified by context



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/oraora/meta.rb', line 14

def find(context)
  node = case context.level
           when nil
             @cache[context] || Meta::Database.from_oci(@oci)
           when :schema
             @cache[context] || Meta::Schema.from_oci(@oci, context.schema)
           when :object
             @cache[context] || Meta::Object.from_oci(@oci, context.schema, context.object, context.object_type)
           when :column
             find(context.dup.up).columns(context.column)
         end
  @cache[context] = node if node && context.level != :column
  node
end