Class: Cliqr::Parser::OptionToken Private
- Defined in:
- lib/cliqr/parser/option_token.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a option token
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ String
private
Name of the option token.
-
#value ⇒ String
private
Value of the option token.
Attributes inherited from Token
Instance Method Summary collapse
-
#build ⇒ Hash
private
Get the token representation.
-
#collect(input_builder) ⇒ Cliqr::Parser::ParsedInputBuilder
private
Collect this token’s name and value into a input builder.
-
#initialize(name, arg) ⇒ OptionToken
constructor
private
Create a new option token with a name and value.
-
#valid? ⇒ Boolean
private
A option token is not valid if it does not have a name.
Methods inherited from Token
Constructor Details
#initialize(name, arg) ⇒ OptionToken
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new option token with a name and value
23 24 25 26 27 28 |
# File 'lib/cliqr/parser/option_token.rb', line 23 def initialize(name, arg) super(arg) @name = name # @value = value end |
Instance Attribute Details
#name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Name of the option token
12 13 14 |
# File 'lib/cliqr/parser/option_token.rb', line 12 def name @name end |
#value ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Value of the option token
17 18 19 |
# File 'lib/cliqr/parser/option_token.rb', line 17 def value @value end |
Instance Method Details
#build ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the token representation
33 34 35 36 37 38 |
# File 'lib/cliqr/parser/option_token.rb', line 33 def build { :name => @name.to_s, :value => @value } end |
#collect(input_builder) ⇒ Cliqr::Parser::ParsedInputBuilder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Collect this token’s name and value into a input builder
arguments
53 54 55 |
# File 'lib/cliqr/parser/option_token.rb', line 53 def collect(input_builder) input_builder.add_option_token(self) unless active? end |
#valid? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A option token is not valid if it does not have a name
43 44 45 |
# File 'lib/cliqr/parser/option_token.rb', line 43 def valid? !@name.nil? end |