class Uptrace::DSN
Constants
- KEYS
Attributes
dsn[R]
port[R]
Public Class Methods
new(dsn)
click to toggle source
# File lib/uptrace/dsn.rb, line 10 def initialize(dsn) raise ArgumentError, "DSN can't be empty" if dsn.empty? begin uri = URI.parse(dsn) rescue URI::InvalidURIError => e raise ArgumentError, %(can't parse DSN=#{dsn.inspect}: #{e}) end @dsn = dsn @project_id = uri.path.delete_prefix('/') @token = uri.user @host = uri.host @port = uri.port @scheme = uri.scheme KEYS.each do |k| v = public_send(k) raise ArgumentError, %(DSN=#{dsn.inspect} does not have a #{k}) if v.nil? || v.empty? end end
Public Instance Methods
to_s()
click to toggle source
# File lib/uptrace/dsn.rb, line 32 def to_s @dsn end