Class: Gloo::Core::Verb
Direct Known Subclasses
Verbs::Alert, Verbs::Beep, Verbs::Break, Verbs::Cls, Verbs::Context, Verbs::Create, Verbs::Execute, Verbs::Files, Verbs::Help, Verbs::If, Verbs::Invoke, Verbs::List, Verbs::Load, Verbs::Log, Verbs::Move, Verbs::Put, Verbs::Quit, Verbs::Redirect, Verbs::Reload, Verbs::Run, Verbs::Save, Verbs::Show, Verbs::Tell, Verbs::Unless, Verbs::Unload, Verbs::Version, Verbs::Wait
Constant Summary
Constants inherited from Baseo
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
Attributes inherited from Baseo
Class Method Summary collapse
-
.help ⇒ Object
Get help for this verb.
-
.inherited(subclass) ⇒ Object
Register verbs when they are loaded.
-
.keyword ⇒ Object
Get the Verb’s keyword.
-
.keyword_shortcut ⇒ Object
Get the Verb’s keyword shortcut.
Instance Method Summary collapse
-
#display_value ⇒ Object
Generic function to get display value.
-
#initialize(engine, tokens, params = []) ⇒ Verb
constructor
Set up the verb.
-
#run ⇒ Object
Run the verb.
-
#type_display ⇒ Object
The object type, suitable for display.
Constructor Details
#initialize(engine, tokens, params = []) ⇒ Verb
Set up the verb.
19 20 21 22 23 |
# File 'lib/gloo/core/verb.rb', line 19 def initialize( engine, tokens, params = [] ) @engine = engine @tokens = tokens @params = params end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
14 15 16 |
# File 'lib/gloo/core/verb.rb', line 14 def params @params end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
14 15 16 |
# File 'lib/gloo/core/verb.rb', line 14 def tokens @tokens end |
Class Method Details
.help ⇒ Object
Get help for this verb.
81 82 83 |
# File 'lib/gloo/core/verb.rb', line 81 def self.help return 'No help found.' end |
.inherited(subclass) ⇒ Object
Register verbs when they are loaded.
28 29 30 |
# File 'lib/gloo/core/verb.rb', line 28 def self.inherited( subclass ) Dictionary.instance.register_verb( subclass ) end |
.keyword ⇒ Object
Get the Verb’s keyword.
The keyword will be in lower case only. It is used by the parser.
48 49 50 |
# File 'lib/gloo/core/verb.rb', line 48 def self.keyword raise 'this method should be overriden' end |
.keyword_shortcut ⇒ Object
Get the Verb’s keyword shortcut.
55 56 57 |
# File 'lib/gloo/core/verb.rb', line 55 def self.keyword_shortcut raise 'this method should be overriden' end |
Instance Method Details
#display_value ⇒ Object
Generic function to get display value. Can be used for debugging, etc.
70 71 72 |
# File 'lib/gloo/core/verb.rb', line 70 def display_value return self.class.keyword end |
#run ⇒ Object
Run the verb.
We’ll mark the application as not running and let the engine stop gracefully next time through the loop.
38 39 40 |
# File 'lib/gloo/core/verb.rb', line 38 def run raise 'this method should be overriden' end |
#type_display ⇒ Object
The object type, suitable for display.
62 63 64 |
# File 'lib/gloo/core/verb.rb', line 62 def type_display return self.class.keyword end |