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
- #exit ⇒ Object
-
#initialize(&block) ⇒ Command
constructor
A new instance of Command.
- #method_missing(sym, *args, &block) ⇒ Object
- #user_input ⇒ Object
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
Returns a new instance of Command.
6 7 8 9 |
# File 'lib/rushmate/command.rb', line 6 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
16 17 18 |
# File 'lib/rushmate/command.rb', line 16 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
11 12 13 14 |
# File 'lib/rushmate/command.rb', line 11 def execute(thing) shell.execute(thing) $last_res end |
#exit ⇒ Object
20 21 22 |
# File 'lib/rushmate/command.rb', line 20 def exit Rushmate::Exit end |
#user_input ⇒ Object
24 25 26 |
# File 'lib/rushmate/command.rb', line 24 def user_input Rushmate::UserInput end |