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

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

Direct Known Subclasses

LongOption, ShortOption

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from T::Sig

sig

Constructor Details

#initialize(name, value) ⇒ Option

Returns a new instance of Option.



31
32
33
34
35
# File 'lib/cli/kit/args/parser/node.rb', line 31

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



44
45
46
# File 'lib/cli/kit/args/parser/node.rb', line 44

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

#inspectObject



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

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