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.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/malone.rb', line 80

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.



77
78
79
# File 'lib/malone.rb', line 77

def auth
  @auth
end

#domainObject

Returns the value of attribute domain.



76
77
78
# File 'lib/malone.rb', line 76

def domain
  @domain
end

#hostObject

Returns the value of attribute host.



72
73
74
# File 'lib/malone.rb', line 72

def host
  @host
end

#passwordObject

Returns the value of attribute password.



75
76
77
# File 'lib/malone.rb', line 75

def password
  @password
end

#portObject

Returns the value of attribute port.



73
74
75
# File 'lib/malone.rb', line 73

def port
  @port
end

#tlsObject

Returns the value of attribute tls.



78
79
80
# File 'lib/malone.rb', line 78

def tls
  @tls
end

#userObject

Returns the value of attribute user.



74
75
76
# File 'lib/malone.rb', line 74

def user
  @user
end