class Console1984::CommandValidator::ParsedCommand
Parses a command string and exposes different constructs to be used by validations.
Internally, it uses the parser gem to perform the parsing.
Attributes
raw_command[R]
Public Class Methods
new(raw_command)
click to toggle source
# File lib/console1984/command_validator/parsed_command.rb, line 11 def initialize(raw_command) @raw_command = Array(raw_command).join("\n") end
Private Instance Methods
command_parser()
click to toggle source
# File lib/console1984/command_validator/parsed_command.rb, line 16 def command_parser @command_parser ||= Console1984::CommandValidator::CommandParser.new.tap do |processor| ast = Parser::CurrentRuby.parse(raw_command) processor.process(ast) rescue Parser::SyntaxError # Fail open with syntax errors end end