Class: Yap::Shell::Command
- Inherits:
-
Object
- Object
- Yap::Shell::Command
- Defined in:
- lib/yap/shell/commands.rb
Direct Known Subclasses
BuiltinCommand, FileSystemCommand, RubyCommand, ShellCommand, UnknownCommand
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.
27 28 29 30 31 32 33 |
# File 'lib/yap/shell/commands.rb', line 27 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.
24 25 26 |
# File 'lib/yap/shell/commands.rb', line 24 def args @args end |
#heredoc ⇒ Object
Returns the value of attribute heredoc.
25 26 27 |
# File 'lib/yap/shell/commands.rb', line 25 def heredoc @heredoc end |
#line ⇒ Object
Returns the value of attribute line.
24 25 26 |
# File 'lib/yap/shell/commands.rb', line 24 def line @line end |
#str ⇒ Object
Returns the value of attribute str.
24 25 26 |
# File 'lib/yap/shell/commands.rb', line 24 def str @str end |
#world ⇒ Object
Returns the value of attribute world.
24 25 26 |
# File 'lib/yap/shell/commands.rb', line 24 def world @world end |
Instance Method Details
#to_executable_str ⇒ Object
41 42 43 |
# File 'lib/yap/shell/commands.rb', line 41 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
35 36 37 |
# File 'lib/yap/shell/commands.rb', line 35 def to_s "#{self.class.name}(#{str.inspect})" end |