Class: Gapic::PathPattern::CollectionIdSegment

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ CollectionIdSegment

Returns a new instance of CollectionIdSegment.



228
229
230
231
# File 'lib/gapic/path_pattern/segment.rb', line 228

def initialize pattern
  @type     = :collection_id
  @pattern  = pattern
end

Instance Attribute Details

#patternString (readonly)

Returns The pattern of the segment, for the positional segment it is also a pattern of its resource.

Returns:

  • (String)

    The pattern of the segment, for the positional segment it is also a pattern of its resource



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/gapic/path_pattern/segment.rb', line 224

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

  # @private
  def == other
    return false unless other.is_a? self.class

    (pattern == other.pattern)
  end
end

#typeObject (readonly)

Returns the value of attribute type.



225
226
227
# File 'lib/gapic/path_pattern/segment.rb', line 225

def type
  @type
end

Instance Method Details

#nontrivial_resource_pattern?Boolean

Whether the segment provides a nontrivial resource pattern

Returns:

  • (Boolean)


250
251
252
# File 'lib/gapic/path_pattern/segment.rb', line 250

def nontrivial_resource_pattern?
  false
end

#path_stringString

Path string for this segment

Returns:

  • (String)


264
265
266
# File 'lib/gapic/path_pattern/segment.rb', line 264

def path_string
  pattern
end

#pattern_templateString

A pattern template for this segment

Returns:

  • (String)


271
272
273
# File 'lib/gapic/path_pattern/segment.rb', line 271

def pattern_template
  pattern
end

#positional?Boolean

Whether the segment is positional

Returns:

  • (Boolean)


236
237
238
# File 'lib/gapic/path_pattern/segment.rb', line 236

def positional?
  false
end

#provides_arguments?Boolean

Whether the segment provides arguments

Returns:

  • (Boolean)


257
258
259
# File 'lib/gapic/path_pattern/segment.rb', line 257

def provides_arguments?
  false
end

#resource_pattern?Boolean

Whether the segment provides a resource pattern

Returns:

  • (Boolean)


243
244
245
# File 'lib/gapic/path_pattern/segment.rb', line 243

def resource_pattern?
  false
end