Class: Kaiseki::ListParser
- Includes:
- Parseable
- Defined in:
- lib/parser_list.rb
Instance Attribute Summary collapse
-
#delimiter ⇒ Object
readonly
Returns the value of attribute delimiter.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(expected, delimiter = ',') ⇒ ListParser
constructor
A new instance of ListParser.
- #to_s ⇒ Object
Methods included from Parseable
#&, #action, #and?, #cast, #filter, #list, #merge, #not!, #one_or_more, #optional, #override, #parse, #predicate?, #protect, #repeat, #set, #skip, #tag_error, #tag_result, #to_parseable, #validate, #zero_or_more, #|
Constructor Details
#initialize(expected, delimiter = ',') ⇒ ListParser
Returns a new instance of ListParser.
6 7 8 9 10 |
# File 'lib/parser_list.rb', line 6 def initialize expected, delimiter = ',' raise ArgumentError, "expected must not be a predicate" if expected.predicate? @expected = expected @delimiter = delimiter end |
Instance Attribute Details
#delimiter ⇒ Object (readonly)
Returns the value of attribute delimiter.
4 5 6 |
# File 'lib/parser_list.rb', line 4 def delimiter @delimiter end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
4 5 6 |
# File 'lib/parser_list.rb', line 4 def expected @expected end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
12 13 14 |
# File 'lib/parser_list.rb', line 12 def eql? other other.is_a?(self.class) and other.expected == @expected and other.delimiter = @delimiter end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/parser_list.rb', line 18 def to_s "#{@expected}#{@delimiter} ..." end |