Class: Gloo::Verbs::Load
- Inherits:
-
Core::Verb
- Object
- Core::Baseo
- Core::Verb
- Gloo::Verbs::Load
- Defined in:
- lib/gloo/verbs/load.rb
Constant Summary collapse
- KEYWORD =
'load'.freeze
- KEYWORD_SHORT =
'ld'.freeze
- MISSING_EXPR_ERR =
'Missing Expression!'.freeze
- UNKNOWN_OPT_ERR =
'Unknown load option!'.freeze
- WRONG_NUM_ARGS_ERR =
'Wrong number of arguments! 2 or 3 expected.'.freeze
- FEATURE_NOT_IMPLEMENTED_ERR =
'Feature not implemented yet!'.freeze
- FILE_OPT =
'file'.freeze
- EXT_OPT =
'ext'.freeze
- LIB_OPT =
'lib'.freeze
Constants inherited from Core::Baseo
Core::Baseo::NOT_IMPLEMENTED_ERR
Instance Attribute Summary
Attributes inherited from Core::Verb
Attributes inherited from Core::Baseo
Class Method Summary collapse
-
.keyword ⇒ Object
Get the Verb’s keyword.
-
.keyword_shortcut ⇒ Object
Get the Verb’s keyword shortcut.
Instance Method Summary collapse
-
#load_extension(name) ⇒ Object
Load an extension.
-
#load_gloo_file(fn) ⇒ Object
Load a gloo file.
-
#load_library(name) ⇒ Object
Load a library.
-
#run ⇒ Object
Run the verb.
Methods inherited from Core::Verb
#display_value, help, inherited, #initialize, #type_display
Methods inherited from Core::Baseo
Constructor Details
This class inherits a constructor from Gloo::Core::Verb
Class Method Details
.keyword ⇒ Object
Get the Verb’s keyword.
53 54 55 |
# File 'lib/gloo/verbs/load.rb', line 53 def self.keyword return KEYWORD end |
.keyword_shortcut ⇒ Object
Get the Verb’s keyword shortcut.
60 61 62 |
# File 'lib/gloo/verbs/load.rb', line 60 def self.keyword_shortcut return KEYWORD_SHORT end |
Instance Method Details
#load_extension(name) ⇒ Object
Load an extension
75 76 77 78 |
# File 'lib/gloo/verbs/load.rb', line 75 def load_extension( name ) @engine.log.debug "Getting ready to load extension: #{name}" @engine.ext_manager.load_ext name end |
#load_gloo_file(fn) ⇒ Object
Load a gloo file
67 68 69 70 |
# File 'lib/gloo/verbs/load.rb', line 67 def load_gloo_file( fn ) @engine.log.debug "Getting ready to load gloo file: #{fn}" @engine.persist_man.load fn end |
#load_library(name) ⇒ Object
Load a library
83 84 85 86 |
# File 'lib/gloo/verbs/load.rb', line 83 def load_library( name ) @engine.log.debug "Getting ready to load library: #{name}" @engine.lib_manager.load_lib name end |
#run ⇒ Object
Run the verb.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/gloo/verbs/load.rb', line 25 def run if @tokens.token_count == 2 opt = FILE_OPT fn = @tokens.second elsif @tokens.token_count == 3 opt = @tokens.second.strip.downcase fn = @tokens.last else @engine.err WRONG_NUM_ARGS_ERR return end if fn.blank? @engine.err MISSING_EXPR_ERR elsif opt == FILE_OPT load_gloo_file fn elsif opt == EXT_OPT load_extension fn elsif opt == LIB_OPT load_library fn else @engine.err UNKNOWN_OPT_ERR end end |