class Gapic::PathPattern::PositionalSegment
A positional segment in a path pattern.
positional segments have a pattern of wildcards and do not carry a name
@!attribure [r] type
@return [String] The type of this segment
@!attribute [r] position
@return [Integer] The argument position of this segment i.e. it's position if we remove all non-positional segments from the pattern
@!attribute [r] pattern
@return [String] The pattern of the segment, for the positional segment it is also a pattern of its resource
Attributes
pattern[R]
position[R]
type[R]
Public Class Methods
new(position, pattern)
click to toggle source
# File lib/gapic/path_pattern/segment.rb, line 36 def initialize position, pattern @type = :positional @position = position @pattern = pattern end
Public Instance Methods
==(other)
click to toggle source
@private
# File lib/gapic/path_pattern/segment.rb, line 101 def == other return false unless other.is_a? self.class (pattern == other.pattern && position == other.position) end
arguments()
click to toggle source
Names of the segment's arguments @return [Array<String>]
# File lib/gapic/path_pattern/segment.rb, line 73 def arguments [position.to_s] end
expected_path_for_dummy_values(start_index)
click to toggle source
Returns a segment's pattern filled with dummy values
names of the values are generated starting from the index provided
@param start_index [Integer] a starting index for dummy value generation @return [String] a pattern filled with dummy values
# File lib/gapic/path_pattern/segment.rb, line 82 def expected_path_for_dummy_values start_index "value#{start_index}" end
nontrivial_resource_pattern?()
click to toggle source
Whether the segment provides a nontrivial resource pattern @return [Boolean]
# File lib/gapic/path_pattern/segment.rb, line 59 def nontrivial_resource_pattern? false end
path_string()
click to toggle source
Path string for this segment @return [String]
# File lib/gapic/path_pattern/segment.rb, line 89 def path_string "\#{#{position}}" end
pattern_template()
click to toggle source
A pattern template for this segment @return [String]
# File lib/gapic/path_pattern/segment.rb, line 96 def pattern_template pattern end
positional?()
click to toggle source
Whether the segment is positional @return [Boolean]
# File lib/gapic/path_pattern/segment.rb, line 45 def positional? true end
provides_arguments?()
click to toggle source
Whether the segment provides arguments @return [Boolean]
# File lib/gapic/path_pattern/segment.rb, line 66 def provides_arguments? true end
resource_pattern?()
click to toggle source
Whether the segment provides a resource pattern @return [Boolean]
# File lib/gapic/path_pattern/segment.rb, line 52 def resource_pattern? true end