Class: Yap::Shell::FileSystemCommand
Instance Attribute Summary
Attributes inherited from Command
#args, #heredoc, #line, #str, #world
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Command
#initialize
Class Method Details
.===(other) ⇒ Object
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/yap/shell/commands.rb', line 95
def self.===(other)
command = other.split(/\s+/).detect{ |f| !f.include?("=") }
return true if File.executable?(command)
world.env["PATH"].split(":").detect do |path|
File.executable?(File.join(path, command))
end
end
|
.world ⇒ Object
91
92
93
|
# File 'lib/yap/shell/commands.rb', line 91
def self.world
::Yap::World.instance
end
|
Instance Method Details
#to_executable_str ⇒ Object
117
118
119
120
121
122
|
# File 'lib/yap/shell/commands.rb', line 117
def to_executable_str
[
str,
args.join(' ')
].join(' ')
end
|
#to_s ⇒ Object
Also known as:
to_str, inspect
111
112
113
|
# File 'lib/yap/shell/commands.rb', line 111
def to_s
"#{self.class.name}(#{to_executable_str.inspect})"
end
|
#type ⇒ Object
107
108
109
|
# File 'lib/yap/shell/commands.rb', line 107
def type
:FileSystemCommand
end
|