Class: ConnectionHelper
- Inherits:
-
Object
- Object
- ConnectionHelper
- Defined in:
- lib/bottlerocket/models/configuration.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
Returns the value of attribute attrs.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(attrs) ⇒ ConnectionHelper
constructor
A new instance of ConnectionHelper.
- #method_missing(field, *args) ⇒ Object
Constructor Details
#initialize(attrs) ⇒ ConnectionHelper
Returns a new instance of ConnectionHelper.
6 7 8 |
# File 'lib/bottlerocket/models/configuration.rb', line 6 def initialize(attrs) self.attrs = attrs end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(field, *args) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/bottlerocket/models/configuration.rb', line 10 def method_missing(field, *args) begin attrs[field.to_s] rescue super(field, *args) end end |
Instance Attribute Details
#attrs ⇒ Object
Returns the value of attribute attrs.
4 5 6 |
# File 'lib/bottlerocket/models/configuration.rb', line 4 def attrs @attrs end |
Instance Method Details
#connection ⇒ Object
18 19 20 |
# File 'lib/bottlerocket/models/configuration.rb', line 18 def connection "mongodb://" + attrs['database_host'] + ":" + attrs['database_port'].to_s + "/" + attrs['database_name'] end |