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.



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

#argsObject

Returns the value of attribute args.



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

def args
  @args
end

#heredocObject

Returns the value of attribute heredoc.



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

def heredoc
  @heredoc
end

#lineObject

Returns the value of attribute line.



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

def line
  @line
end

#strObject

Returns the value of attribute str.



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

def str
  @str
end

#worldObject

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_strObject

Raises:

  • (NotImplementedError)


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