Class: CLI::Kit::Args::Parser::Node::Option

Inherits:
CLI::Kit::Args::Parser::Node show all
Defined in:
lib/cli/kit/args/parser/node.rb

Direct Known Subclasses

LongOption, ShortOption

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ Option

: (String name, String value) -> void



27
28
29
30
31
# File 'lib/cli/kit/args/parser/node.rb', line 27

def initialize(name, value)
  @name = name
  @value = value
  super()
end

Instance Attribute Details

#nameObject (readonly)

: String



21
22
23
# File 'lib/cli/kit/args/parser/node.rb', line 21

def name
  @name
end

#valueObject (readonly)

: String



24
25
26
# File 'lib/cli/kit/args/parser/node.rb', line 24

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object

: (untyped other) -> bool



40
41
42
# File 'lib/cli/kit/args/parser/node.rb', line 40

def ==(other)
  !!(super(other) && @value == other.value && @name == other.name)
end

#inspectObject

: -> String



35
36
37
# File 'lib/cli/kit/args/parser/node.rb', line 35

def inspect
  "#<#{self.class.name} #{@name}=#{@value}>"
end