Top Level Namespace
Defined Under Namespace
Modules: OrientDB Classes: Array, Date, DateTime, Float, Hash, NilClass, Time
Constant Summary collapse
- GEM_ROOT =
File.(File.join(File.dirname(__FILE__), '..'))
- SPEC_ROOT =
GEM_ROOT + '/spec'
- TEMP_DIR =
File. Dir.pwd + '/tmp'
- TEST_DB_PATH =
"#{TEMP_DIR}/databases/db_#{rand(999) + 1}"
- DB =
OrientDB::AR::Base.connection
Instance Method Summary collapse
Instance Method Details
#load_models ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'bin/orientdbar_console', line 32 def load_models %w{ person simple_person address phone_number customer flo_admin product invoice_line invoice }.each do |name| klass_name = name.camelize klass_name = "Flo::Admin" if klass_name == "FloAdmin" klass = klass_name.constantize rescue nil if klass puts ">> Removing class #{klass} ..." remove_constant klass end puts ">> Loading #{klass_name} ..." load SPEC_ROOT + '/models/' + name + '.rb' end end |
#remove_constant(const) ⇒ Object
:nodoc:
24 25 26 27 28 29 30 |
# File 'bin/orientdbar_console', line 24 def remove_constant(const) #:nodoc: names = const.to_s.sub(/^::(Object)?/, 'Object::').split("::") to_remove = names.pop parent = names.join('::').constantize parent.instance_eval { remove_const to_remove } true end |