Class: Rushmate::Command
- Inherits:
-
Object
- Object
- Rushmate::Command
- Includes:
- TextmateHelper
- Defined in:
- lib/rushmate/command.rb
Overview
The Command Class is the main class in Rushmate.
Instance Attribute Summary collapse
-
#shell ⇒ Object
Returns the value of attribute shell.
Instance Method Summary collapse
-
#execute(thing) ⇒ Object
execute the parameter against a Rush::Shell instance.
-
#exit ⇒ Object
return a reference to Rushmate::Exit This is useful for shortening up your code Example:.
-
#initialize(&block) ⇒ Command
constructor
Class construction is designed to take a block that gets executed as part of the class.
-
#method_missing(sym, *args, &block) ⇒ Object
anything not defined in Rushmate::Command should be defered to Rushmate::Command#execute.
-
#user_input ⇒ Object
return a reference to Rushmate::UserInput This is useful for shortening up your code Example:.
Methods included from TextmateHelper
#current_line, #current_word, #project_directory, #project_directory?, #selected_text, #tm_directory, #tm_file, #tm_filename
Constructor Details
#initialize(&block) ⇒ Command
14 15 16 17 |
# File 'lib/rushmate/command.rb', line 14 def initialize(&block) setup_shell self.instance_eval(&block) if block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
anything not defined in Rushmate::Command should be defered to Rushmate::Command#execute
27 28 29 |
# File 'lib/rushmate/command.rb', line 27 def method_missing(sym, *args, &block) execute sym.to_s end |
Instance Attribute Details
#shell ⇒ Object
Returns the value of attribute shell.
5 6 7 |
# File 'lib/rushmate/command.rb', line 5 def shell @shell end |
Instance Method Details
#execute(thing) ⇒ Object
execute the parameter against a Rush::Shell instance
20 21 22 23 |
# File 'lib/rushmate/command.rb', line 20 def execute(thing) shell.execute(thing) $last_res end |