module Terminalwire::Client::Entitlement
def self.from_url(url)
def self.from_url(url) url = URI(url) case url.host when RootPolicy::HOST RootPolicy.new else Policy.new authority: url_authority(url) end end
def self.url_authority(url)
def self.url_authority(url) # I had to lift this from URI::HTTP because `ws://` doesn't # have an authority method. if url.port == url.default_port url.host else "#{url.host}:#{url.port}" end end