class Mysh::InputWrapper
An action compatible wrapper for a input.
Attributes
raw[R]
Access the raw text.
Public Class Methods
new(raw)
click to toggle source
Build an input wrapper.
# File lib/mysh/input_wrapper.rb, line 10 def initialize(raw) @raw = raw.chomp @raw_command = @raw_body = nil end
Public Instance Methods
args()
click to toggle source
Get the parsed arguments
# File lib/mysh/input_wrapper.rb, line 50 def args Mysh.parse_args(cooked_body) end
cooked()
click to toggle source
Access the massaged text.
# File lib/mysh/input_wrapper.rb, line 44 def cooked body = cooked_body raw_command + (body.empty? ? "" : " " + body) end
cooked_body()
click to toggle source
Get the preprocessed argument text.
# File lib/mysh/input_wrapper.rb, line 39 def cooked_body raw_body.preprocess end
parsed()
click to toggle source
Get the parsed command line.
# File lib/mysh/input_wrapper.rb, line 55 def parsed [raw_command] + args end
quick()
click to toggle source
Set up input for a quick style command.
# File lib/mysh/input_wrapper.rb, line 60 def quick @raw_command = quick_command @raw_body = quick_body self end
quick_body()
click to toggle source
Get the balance of the raw string.
# File lib/mysh/input_wrapper.rb, line 24 def quick_body @raw[1..-1] || "" end
quick_command()
click to toggle source
Get the first raw character.
# File lib/mysh/input_wrapper.rb, line 19 def quick_command @raw[0] || "" end
raw_body()
click to toggle source
Get the parameter text.
# File lib/mysh/input_wrapper.rb, line 34 def raw_body @raw_body ||= @raw[(raw_command.length + 1)..-1] || "" end
raw_command()
click to toggle source
Get the command word if it exists.
# File lib/mysh/input_wrapper.rb, line 29 def raw_command @raw_command ||= @raw.split[0] || "" end