Class: Reditor::Command
- Inherits:
-
Thor
- Object
- Thor
- Reditor::Command
show all
- Defined in:
- lib/reditor/command.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
39
40
41
|
# File 'lib/reditor/command.rb', line 39
def method_missing(name, *args, &block)
open name
end
|
Instance Method Details
#open(name) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/reditor/command.rb', line 13
def open(name)
detect_exec name do |dir, file|
say "Moving to #{dir}", :green
Dir.chdir dir do
say "Opening #{file}", :green
exec editor_command, file
end
end
end
|
#sh(name) ⇒ Object
25
26
27
28
29
30
31
32
|
# File 'lib/reditor/command.rb', line 25
def sh(name)
detect_exec name do |dir, _|
say "Moving to #{dir}", :green
Dir.chdir dir do
exec shell_command
end
end
end
|
#version ⇒ Object
35
36
37
|
# File 'lib/reditor/command.rb', line 35
def version
say "Reditor version #{VERSION}"
end
|