Class: Malone::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/malone.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Configuration

Returns a new instance of Configuration.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/malone.rb', line 71

def initialize(options)
  opts = options.dup

  @tls = true

  url = opts.delete(:url) || ENV["MALONE_URL"]

  if url
    uri = URI(url)

    opts[:host]     ||= uri.host
    opts[:port]     ||= uri.port.to_i
    opts[:user]     ||= unescaped(uri.user)
    opts[:password] ||= unescaped(uri.password)
  end

  opts.each do |key, val|
    send(:"#{key}=", val)
  end
end

Instance Attribute Details

#authObject

Returns the value of attribute auth.



68
69
70
# File 'lib/malone.rb', line 68

def auth
  @auth
end

#domainObject

Returns the value of attribute domain.



67
68
69
# File 'lib/malone.rb', line 67

def domain
  @domain
end

#hostObject

Returns the value of attribute host.



63
64
65
# File 'lib/malone.rb', line 63

def host
  @host
end

#passwordObject

Returns the value of attribute password.



66
67
68
# File 'lib/malone.rb', line 66

def password
  @password
end

#portObject

Returns the value of attribute port.



64
65
66
# File 'lib/malone.rb', line 64

def port
  @port
end

#tlsObject

Returns the value of attribute tls.



69
70
71
# File 'lib/malone.rb', line 69

def tls
  @tls
end

#userObject

Returns the value of attribute user.



65
66
67
# File 'lib/malone.rb', line 65

def user
  @user
end