Class: Dbmanager::Environment
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Dbmanager::Environment
- Defined in:
- lib/dbmanager/environment.rb
Instance Method Summary collapse
-
#flag(attribute, flag) ⇒ Object
returns the flag formatted for the requested attribute, if present.
-
#protected? ⇒ Boolean
verifies whether the environment is protected from overwriting or not.
Instance Method Details
#flag(attribute, flag) ⇒ Object
returns the flag formatted for the requested attribute, if present. env = Environment.new(:password => ‘secret’) env.flag(‘password’, ‘p’) # => -psecret env.flag(‘foo’, ‘f’) # => nil
34 35 36 37 |
# File 'lib/dbmanager/environment.rb', line 34 def flag(attribute, flag) value = send attribute "-#{flag}#{value}" if value.present? end |
#protected? ⇒ Boolean
verifies whether the environment is protected from overwriting or not.
22 23 24 25 26 27 28 |
# File 'lib/dbmanager/environment.rb', line 22 def protected? if name =~ /production/ protected != false else protected == true end end |