class Google::Cloud::Firestore::ResourcePath

@private

Represents a resource path to the Firestore API.

Constants

RESOURCE_PATH_RE

Attributes

database_id[R]
project_id[R]
segments[R]

Public Class Methods

from_path(path) click to toggle source
# File lib/google/cloud/firestore/resource_path.rb, line 51
def self.from_path path
  data = RESOURCE_PATH_RE.match path
  new data[1], data[2], data[3]
end
new(project_id, database_id, segments) click to toggle source

Creates a resource path object.

@param [Array<String>] segments One or more strings representing the resource path.

@return [ResourcePath] The resource path object.

# File lib/google/cloud/firestore/resource_path.rb, line 40
def initialize project_id, database_id, segments
  @project_id = project_id
  @database_id = database_id
  @segments = segments.split "/"
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/google/cloud/firestore/resource_path.rb, line 46
def <=> other
  return nil unless other.is_a? ResourcePath
  [project_id, database_id, segments] <=> [other.project_id, other.database_id, other.segments]
end