Class: Yap::Shell::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/yap/shell/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject

Returns the value of attribute args.



25
26
27
# File 'lib/yap/shell/commands.rb', line 25

def args
  @args
end

#heredocObject

Returns the value of attribute heredoc.



26
27
28
# File 'lib/yap/shell/commands.rb', line 26

def heredoc
  @heredoc
end

#lineObject

Returns the value of attribute line.



25
26
27
# File 'lib/yap/shell/commands.rb', line 25

def line
  @line
end

#strObject

Returns the value of attribute str.



25
26
27
# File 'lib/yap/shell/commands.rb', line 25

def str
  @str
end

#worldObject

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_strObject

Raises:

  • (NotImplementedError)


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_sObject 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