Class: ATProto::AtUri

Inherits:
T::Struct
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/at_protocol/at_uri.rb

Instance Method Summary collapse

Instance Method Details

#resolve(pds: "https://bsky.social") ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/at_protocol/at_uri.rb', line 87

def resolve(pds: "https://bsky.social")
  if @collection.nil?
    Repo.new(@repo.to_s, pds)
  elsif @rkey.nil?
    Repo::Collection.new(Repo.new(@repo.to_s, pds), @collection.to_s, pds)
  else
    Record.from_uri(self, pds)
  end
end

#to_sObject



99
100
101
# File 'lib/at_protocol/at_uri.rb', line 99

def to_s
  "at://#{@repo}/#{@collection.nil? ? "" : "#{@collection}/"}#{@rkey}"
end