Class: Mysh::StringSource
Overview
A wrapper for a string with mysh commands.
Instance Method Summary collapse
-
#eoi? ⇒ Boolean
Have we reached the end of input?.
-
#get_command(_str = "") ⇒ Object
(also: #get_command_extra)
Get the initial line of command input.
-
#initialize(str) ⇒ StringSource
constructor
Setup the string source.
Constructor Details
#initialize(str) ⇒ StringSource
Setup the string source.
10 11 12 13 |
# File 'lib/mysh/sources/string.rb', line 10 def initialize(str) @eoi = false @read_pt = str.lines.each end |
Instance Method Details
#eoi? ⇒ Boolean
Have we reached the end of input?
27 28 29 |
# File 'lib/mysh/sources/string.rb', line 27 def eoi? @eoi end |
#get_command(_str = "") ⇒ Object Also known as: get_command_extra
Get the initial line of command input.
16 17 18 19 20 21 |
# File 'lib/mysh/sources/string.rb', line 16 def get_command(_str="") @read_pt.next rescue StopIteration @eoi = true "\n" end |