Module: ActiveOrient::Init

Defined in:
lib/init.rb

Instance Method Summary collapse

Instance Method Details

#define_namespace(yml: {}, namespace: nil) ⇒ Object

Parameters: yml: hash from config.yml , namespace: Class to use as Namespace



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/init.rb', line 8

def define_namespace  yml: {}, namespace: nil
    ActiveOrient::Model.namespace = if namespace.present? 
      namespace
          else
      n= yml[:namespace].presence || :self
      case n
      when :self
        ActiveOrient::Model
      when :object
        Object
      when :active_orient
        ActiveOrient
      end
          end
    ## initialitze Edge and Vertex classes in the namespace
#      ActiveOrient::Model.orientdb_class( name:"E", superclass: "").new
#      ActiveOrient::Model.orientdb_class( name:"V", superclass: "").new
end

#vertex_and_edge_classObject



28
29
30
31
32
33
# File 'lib/init.rb', line 28

def vertex_and_edge_class
  ORD.create_classes 'E', 'V'
  E.ref_name = 'E'
  V.ref_name = 'V'

end