Class: Gloo::Core::Verb
Direct Known Subclasses
Verbs::Alert, Verbs::Beep, Verbs::Cls, Verbs::Context, Verbs::Create, Verbs::Execute, Verbs::Help, Verbs::If, Verbs::List, Verbs::Load, Verbs::Move, Verbs::Put, Verbs::Quit, Verbs::Run, Verbs::Save, Verbs::Show, Verbs::Tell, Verbs::Unless, Verbs::Version, Verbs::Wait
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(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(tokens, params = []) ⇒ Verb
Set up the verb.
19 20 21 22 |
# File 'lib/gloo/core/verb.rb', line 19 def initialize( tokens, params = [] ) @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.
80 81 82 |
# File 'lib/gloo/core/verb.rb', line 80 def self.help return 'No help found.' end |
.inherited(subclass) ⇒ Object
Register verbs when they are loaded.
27 28 29 |
# File 'lib/gloo/core/verb.rb', line 27 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.
47 48 49 |
# File 'lib/gloo/core/verb.rb', line 47 def self.keyword raise 'this method should be overriden' end |
.keyword_shortcut ⇒ Object
Get the Verb’s keyword shortcut.
54 55 56 |
# File 'lib/gloo/core/verb.rb', line 54 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.
69 70 71 |
# File 'lib/gloo/core/verb.rb', line 69 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.
37 38 39 |
# File 'lib/gloo/core/verb.rb', line 37 def run raise 'this method should be overriden' end |
#type_display ⇒ Object
The object type, suitable for display.
61 62 63 |
# File 'lib/gloo/core/verb.rb', line 61 def type_display return self.class.keyword end |