class Mysh::StringSource

A wrapper for a string with mysh commands.

Public Class Methods

new(str) click to toggle source

Setup the string source.

# File lib/mysh/sources/string.rb, line 10
def initialize(str)
  @eoi = false
  @read_pt = str.lines.each
end

Public Instance Methods

eoi?() click to toggle source

Have we reached the end of input?

# File lib/mysh/sources/string.rb, line 27
def eoi?
  @eoi
end
get_command(_str="") click to toggle source

Get the initial line of command input.

# File lib/mysh/sources/string.rb, line 16
def get_command(_str="")
  @read_pt.next
rescue StopIteration
  @eoi = true
  "\n"
end
Also aliased as: get_command_extra
get_command_extra(_str="")

Set up an alias as these two are identical.

Alias for: get_command