Class: Rushmate::Command

Inherits:
Object
  • Object
show all
Includes:
TextmateHelper
Defined in:
lib/rushmate/command.rb

Overview

The Command Class is the main class in Rushmate.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#shellObject

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

#exitObject



20
21
22
# File 'lib/rushmate/command.rb', line 20

def exit
  Rushmate::Exit
end

#user_inputObject



24
25
26
# File 'lib/rushmate/command.rb', line 24

def user_input
  Rushmate::UserInput
end