Class: DatabaseConnector
- Inherits:
-
Object
- Object
- DatabaseConnector
- Defined in:
- lib/generators/harmonia/templates/database_connector.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
Returns the value of attribute hostname.
Instance Method Summary collapse
Instance Attribute Details
#hostname ⇒ Object
Returns the value of attribute hostname.
4 5 6 |
# File 'lib/generators/harmonia/templates/database_connector.rb', line 4 def hostname @hostname end |
Instance Method Details
#open_database(&block) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/harmonia/templates/database_connector.rb', line 6 def open_database(&block) raise ArgumentError, 'No hostname set' if @hostname.blank? raise ArgumentError, 'No block given' if block.blank? connect yield block ensure disconnect end |