Class: Chronar::Parser::ArgumentList
- Inherits:
-
AbstractParslet
- Object
- Parslet::Parser
- AbstractParslet
- Chronar::Parser::ArgumentList
- Defined in:
- lib/chronar/parser/argument_list.rb
Instance Attribute Summary collapse
-
#allow_no_list ⇒ Object
readonly
Returns the value of attribute allow_no_list.
-
#list_range ⇒ Object
readonly
Returns the value of attribute list_range.
-
#specifiers ⇒ Object
readonly
Returns the value of attribute specifiers.
Instance Method Summary collapse
-
#initialize(specifiers = [statement], list_range = (0..nil), allow_no_list: true) ⇒ ArgumentList
constructor
A new instance of ArgumentList.
Methods inherited from AbstractParslet
Constructor Details
#initialize(specifiers = [statement], list_range = (0..nil), allow_no_list: true) ⇒ ArgumentList
Returns a new instance of ArgumentList.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/chronar/parser/argument_list.rb', line 11 def initialize(specifiers = [statement], list_range = (0..nil), allow_no_list: true) super() if specifiers.is_a?(Range) list_range = specifiers specifiers = [statement] end raise ArgumentError, "must use at least one specifier" if specifiers.empty? if list_range.end && list_range.end < specifiers.size raise ArgumentError, "more specifiers than allowed by list range" end @specifiers = specifiers @list_range = list_range @allow_no_list = allow_no_list end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Chronar::Parser::AbstractParslet
Instance Attribute Details
#allow_no_list ⇒ Object (readonly)
Returns the value of attribute allow_no_list.
9 10 11 |
# File 'lib/chronar/parser/argument_list.rb', line 9 def allow_no_list @allow_no_list end |
#list_range ⇒ Object (readonly)
Returns the value of attribute list_range.
9 10 11 |
# File 'lib/chronar/parser/argument_list.rb', line 9 def list_range @list_range end |
#specifiers ⇒ Object (readonly)
Returns the value of attribute specifiers.
9 10 11 |
# File 'lib/chronar/parser/argument_list.rb', line 9 def specifiers @specifiers end |