Class: BettyResource::Configuration
- Inherits:
-
Object
- Object
- BettyResource::Configuration
- Defined in:
- lib/betty_resource/configuration.rb
Defined Under Namespace
Classes: InvalidError
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate! ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 9 |
# File 'lib/betty_resource/configuration.rb', line 5 def initialize(args = {}) args.each do |key, value| send("#{key}=", value) if [:host, :user, :password].include?(key.to_sym) end end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
13 14 15 |
# File 'lib/betty_resource/configuration.rb', line 13 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
13 14 15 |
# File 'lib/betty_resource/configuration.rb', line 13 def password @password end |
#user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/betty_resource/configuration.rb', line 13 def user @user end |
Instance Method Details
#validate! ⇒ Object
15 16 17 |
# File 'lib/betty_resource/configuration.rb', line 15 def validate! raise InvalidError if [:host, :user, :password].any? { |option| send(option).to_s.strip.empty? } end |