Class: Gapic::PathPattern::CollectionIdSegment
- Inherits:
-
Object
- Object
- Gapic::PathPattern::CollectionIdSegment
- Defined in:
- lib/gapic/path_pattern/segment.rb
Overview
A CollectionId segment in a path template. CollectionId segments are basically string literals
Instance Attribute Summary collapse
-
#pattern ⇒ String
readonly
The pattern of the segment, for the positional segment it is also a pattern of its resource.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(pattern) ⇒ CollectionIdSegment
constructor
A new instance of CollectionIdSegment.
-
#nontrivial_resource_pattern? ⇒ Boolean
Whether the segment provides a nontrivial resource pattern.
-
#path_string ⇒ String
Path string for this segment.
-
#pattern_template ⇒ String
A pattern template for this segment.
-
#positional? ⇒ Boolean
Whether the segment is positional.
-
#provides_arguments? ⇒ Boolean
Whether the segment provides arguments.
-
#resource_id_segment? ⇒ Boolean
Whether the segment is a resource id segment.
-
#resource_pattern? ⇒ Boolean
Whether the segment provides a resource pattern.
-
#simplified_pattern ⇒ String
The difference between
simplified_pattern
andpattern
does not exist for the CollectionId segments. -
#to_regex_str ⇒ String
Creates a string with a regex representation of this segment's pattern.
Constructor Details
#initialize(pattern) ⇒ CollectionIdSegment
Returns a new instance of CollectionIdSegment.
301 302 303 304 |
# File 'lib/gapic/path_pattern/segment.rb', line 301 def initialize pattern @type = :collection_id @pattern = pattern end |
Instance Attribute Details
#pattern ⇒ String (readonly)
Returns The pattern of the segment, for the positional segment it is also a pattern of its resource.
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/gapic/path_pattern/segment.rb', line 297 class CollectionIdSegment attr_reader :type attr_reader :pattern def initialize pattern @type = :collection_id @pattern = pattern end ## # Whether the segment is positional # @return [Boolean] def positional? false end ## # Whether the segment provides a resource pattern # @return [Boolean] def resource_pattern? false end ## # Whether the segment provides a nontrivial resource pattern # @return [Boolean] def nontrivial_resource_pattern? false end ## # Whether the segment provides arguments # @return [Boolean] def provides_arguments? false end ## # Path string for this segment # @return [String] def path_string pattern end ## # A pattern template for this segment # @return [String] def pattern_template pattern end ## # Whether the segment is a resource id segment # @return [Boolean] def resource_id_segment? false end ## # The difference between `simplified_pattern` and `pattern` # does not exist for the CollectionId segments # @return [String] def simplified_pattern pattern end ## # Creates a string with a regex representation of this segment's pattern # @return [String] def to_regex_str pattern end # @private def == other return false unless other.is_a? self.class (pattern == other.pattern) end end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
298 299 300 |
# File 'lib/gapic/path_pattern/segment.rb', line 298 def type @type end |
Instance Method Details
#nontrivial_resource_pattern? ⇒ Boolean
Whether the segment provides a nontrivial resource pattern
323 324 325 |
# File 'lib/gapic/path_pattern/segment.rb', line 323 def nontrivial_resource_pattern? false end |
#path_string ⇒ String
Path string for this segment
337 338 339 |
# File 'lib/gapic/path_pattern/segment.rb', line 337 def path_string pattern end |
#pattern_template ⇒ String
A pattern template for this segment
344 345 346 |
# File 'lib/gapic/path_pattern/segment.rb', line 344 def pattern_template pattern end |
#positional? ⇒ Boolean
Whether the segment is positional
309 310 311 |
# File 'lib/gapic/path_pattern/segment.rb', line 309 def positional? false end |
#provides_arguments? ⇒ Boolean
Whether the segment provides arguments
330 331 332 |
# File 'lib/gapic/path_pattern/segment.rb', line 330 def provides_arguments? false end |
#resource_id_segment? ⇒ Boolean
Whether the segment is a resource id segment
351 352 353 |
# File 'lib/gapic/path_pattern/segment.rb', line 351 def resource_id_segment? false end |
#resource_pattern? ⇒ Boolean
Whether the segment provides a resource pattern
316 317 318 |
# File 'lib/gapic/path_pattern/segment.rb', line 316 def resource_pattern? false end |
#simplified_pattern ⇒ String
The difference between simplified_pattern
and pattern
does not exist for the CollectionId segments
359 360 361 |
# File 'lib/gapic/path_pattern/segment.rb', line 359 def simplified_pattern pattern end |
#to_regex_str ⇒ String
Creates a string with a regex representation of this segment's pattern
366 367 368 |
# File 'lib/gapic/path_pattern/segment.rb', line 366 def to_regex_str pattern end |