Class: Rubysh::TripleLessThan::Shell

Inherits:
BaseDirective show all
Defined in:
lib/rubysh/triple_less_than.rb

Instance Method Summary collapse

Methods inherited from BaseDirective

#apply!, #apply_parent!, #state

Constructor Details

#initialize(fd, opts) ⇒ Shell

Returns a new instance of Shell.



9
10
11
12
# File 'lib/rubysh/triple_less_than.rb', line 9

def initialize(fd, opts)
  @fd = fd
  @opts = opts
end

Instance Method Details

#<(literal = :stdin) ⇒ Object



14
15
16
# File 'lib/rubysh/triple_less_than.rb', line 14

def <(literal=:stdin)
  TripleLessThan.new(@fd, literal)
end

#prepare!Object



18
19
20
# File 'lib/rubysh/triple_less_than.rb', line 18

def prepare!
  raise Rubysh::Error::BaseError.new("You have an incorrect usage of <<<, leading to a #{self.class} instance hanging around. Use it as either: Rubysh.<<< 'my string' or Rubysh::FD(3).<<< 'my string'.")
end

#stringifyObject



22
23
24
# File 'lib/rubysh/triple_less_than.rb', line 22

def stringify
  " << #{fd.stringify} (INVALID SYNTAX)"
end