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.



221
222
223
224
# File 'lib/gapic/path_pattern/segment.rb', line 221

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



218
219
220
221
222
223
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
# File 'lib/gapic/path_pattern/segment.rb', line 218

class CollectionIdSegment
  attr_reader :type, :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.



219
220
221
# File 'lib/gapic/path_pattern/segment.rb', line 219

def type
  @type
end

Instance Method Details

#nontrivial_resource_pattern?Boolean

Whether the segment provides a nontrivial resource pattern

Returns:

  • (Boolean)


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

def nontrivial_resource_pattern?
  false
end

#path_stringString

Path string for this segment

Returns:

  • (String)


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

def path_string
  pattern
end

#pattern_templateString

A pattern template for this segment

Returns:

  • (String)


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

def pattern_template
  pattern
end

#positional?Boolean

Whether the segment is positional

Returns:

  • (Boolean)


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

def positional?
  false
end

#provides_arguments?Boolean

Whether the segment provides arguments

Returns:

  • (Boolean)


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

def provides_arguments?
  false
end

#resource_pattern?Boolean

Whether the segment provides a resource pattern

Returns:

  • (Boolean)


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

def resource_pattern?
  false
end