Class: CmdExecutable::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/cmd_executable/parser.rb

Overview

Parser for CmdExecutable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Parser

Returns a new instance of Parser.



34
35
36
37
# File 'lib/cmd_executable/parser.rb', line 34

def initialize(raw)
  @raw = raw
  @raw.freeze
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



32
33
34
# File 'lib/cmd_executable/parser.rb', line 32

def raw
  @raw
end

Instance Method Details

#commandObject



46
47
48
49
# File 'lib/cmd_executable/parser.rb', line 46

def command
  parse if @command.nil?
  @command
end

#validate?Boolean

Returns:

  • (Boolean)


39
40
41
42
43
44
# File 'lib/cmd_executable/parser.rb', line 39

def validate?
  !@raw.nil? &&
    command_class_validate? &&
    !@raw.empty? &&
    !include_invalid_char?
end