Module: RecordOnChain::Commands::M_LoadDatafile
Instance Method Summary collapse
-
#load_datafile(datafile_path, class_name) ⇒ Object
base method of load_config & load_keyfile.
Instance Method Details
#load_datafile(datafile_path, class_name) ⇒ Object
base method of load_config & load_keyfile
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/record_on_chain/commands/mod_command.rb', line 10 def load_datafile( datafile_path , class_name ) # try to load full_class_name = "RecordOnChain::#{class_name.capitalize}" # get klass => klass.send( :load , path ) => klass.load( path ) klass = Object.const_get( full_class_name ) datafile = klass.send( :load , datafile_path ) # if fail to load becaseu any field is illegal raise "Fail to load #{class_name}.Please check the fields of #{class_name}." if datafile.nil? # success return datafile end |