Class: Google::Gax::PathParse
- Inherits:
-
Rly::Yacc
- Object
- Rly::Yacc
- Google::Gax::PathParse
- Defined in:
- lib/google/gax/path_template.rb
Overview
Parser for the path_template language
Instance Attribute Summary collapse
-
#binding_var_count ⇒ Object
readonly
Returns the value of attribute binding_var_count.
-
#segment_count ⇒ Object
readonly
Returns the value of attribute segment_count.
Instance Method Summary collapse
-
#initialize(*args) ⇒ PathParse
constructor
A new instance of PathParse.
- #parse(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ PathParse
Returns a new instance of PathParse.
54 55 56 57 58 |
# File 'lib/google/gax/path_template.rb', line 54 def initialize(*args) super @segment_count = 0 @binding_var_count = 0 end |
Instance Attribute Details
#binding_var_count ⇒ Object (readonly)
Returns the value of attribute binding_var_count.
52 53 54 |
# File 'lib/google/gax/path_template.rb', line 52 def binding_var_count @binding_var_count end |
#segment_count ⇒ Object (readonly)
Returns the value of attribute segment_count.
52 53 54 |
# File 'lib/google/gax/path_template.rb', line 52 def segment_count @segment_count end |
Instance Method Details
#parse(*args) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/google/gax/path_template.rb', line 60 def parse(*args) segments = super has_path_wildcard = false raise 'path template has no segments' if segments.nil? segments.each do |s| next unless s.kind == TERMINAL && s.literal == '**' if has_path_wildcard raise 'path template cannot contain more than one path wildcard' end has_path_wildcard = true end segments end |