Class: Yap::Shell::Command
- Inherits:
-
Object
- Object
- Yap::Shell::Command
- Defined in:
- lib/yap/shell/commands.rb
Direct Known Subclasses
BuiltinCommand, FileSystemCommand, RubyCommand, ShellCommand
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#heredoc ⇒ Object
Returns the value of attribute heredoc.
-
#line ⇒ Object
Returns the value of attribute line.
-
#str ⇒ Object
Returns the value of attribute str.
-
#world ⇒ Object
Returns the value of attribute world.
Instance Method Summary collapse
-
#initialize(world:, str:, args: [], line: nil, heredoc: nil) ⇒ Command
constructor
A new instance of Command.
- #to_executable_str ⇒ Object
- #to_s ⇒ Object (also: #to_str, #inspect)
Constructor Details
#initialize(world:, str:, args: [], line: nil, heredoc: nil) ⇒ Command
Returns a new instance of Command.
28 29 30 31 32 33 34 |
# File 'lib/yap/shell/commands.rb', line 28 def initialize(world:, str:, args:[], line:nil, heredoc:nil) @world = world @str = str @args = args @heredoc = heredoc @line = line end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
25 26 27 |
# File 'lib/yap/shell/commands.rb', line 25 def args @args end |
#heredoc ⇒ Object
Returns the value of attribute heredoc.
26 27 28 |
# File 'lib/yap/shell/commands.rb', line 26 def heredoc @heredoc end |
#line ⇒ Object
Returns the value of attribute line.
25 26 27 |
# File 'lib/yap/shell/commands.rb', line 25 def line @line end |
#str ⇒ Object
Returns the value of attribute str.
25 26 27 |
# File 'lib/yap/shell/commands.rb', line 25 def str @str end |
#world ⇒ Object
Returns the value of attribute world.
25 26 27 |
# File 'lib/yap/shell/commands.rb', line 25 def world @world end |
Instance Method Details
#to_executable_str ⇒ Object
42 43 44 |
# File 'lib/yap/shell/commands.rb', line 42 def to_executable_str raise NotImplementedError, ":to_executable_str must be implemented by including object." end |
#to_s ⇒ Object Also known as: to_str, inspect
36 37 38 |
# File 'lib/yap/shell/commands.rb', line 36 def to_s "#{self.class.name}(#{str.inspect})" end |