Module: ActiveOrient::Init
- Defined in:
- lib/init.rb
Class Method Summary collapse
-
.define_namespace(yml: {}, namespace: nil) ⇒ Object
Parameters: yml: hash from config.yml , namespace: Class to use as Namespace A custom Constant can be provided via Block.
Instance Method Summary collapse
Class Method Details
.define_namespace(yml: {}, namespace: nil) ⇒ Object
Parameters: yml: hash from config.yml , namespace: Class to use as Namespace A custom Constant can be provided via Block
i.e.
configyml = YAML.load_file (...) # with an entry "namespace:"
ActiveOrient.define_namespace yml: configyml
#or
ActiveOrient.define_namespace namespace: :self | :object | :active_orient
#or
ActiveOrient.define_namespace { IB }
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/init.rb', line 16 def self.define_namespace yml: {}, namespace: nil ActiveOrient::Model.namespace = if namespace.present? namespace elsif block_given? yield 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 |