Class: Malone::Configuration
- Inherits:
-
Object
- Object
- Malone::Configuration
- Defined in:
- lib/malone.rb
Instance Attribute Summary collapse
-
#auth ⇒ Object
Returns the value of attribute auth.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#tls ⇒ Object
Returns the value of attribute tls.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(options) ⇒ Configuration
constructor
A new instance of Configuration.
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() opts = .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
#auth ⇒ Object
Returns the value of attribute auth.
68 69 70 |
# File 'lib/malone.rb', line 68 def auth @auth end |
#domain ⇒ Object
Returns the value of attribute domain.
67 68 69 |
# File 'lib/malone.rb', line 67 def domain @domain end |
#host ⇒ Object
Returns the value of attribute host.
63 64 65 |
# File 'lib/malone.rb', line 63 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
66 67 68 |
# File 'lib/malone.rb', line 66 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
64 65 66 |
# File 'lib/malone.rb', line 64 def port @port end |
#tls ⇒ Object
Returns the value of attribute tls.
69 70 71 |
# File 'lib/malone.rb', line 69 def tls @tls end |
#user ⇒ Object
Returns the value of attribute user.
65 66 67 |
# File 'lib/malone.rb', line 65 def user @user end |