Class: Carefully::Configuration
- Inherits:
-
Object
- Object
- Carefully::Configuration
- Defined in:
- lib/carefully.rb
Instance Attribute Summary collapse
-
#confirmation_message ⇒ Object
Returns the value of attribute confirmation_message.
-
#confirmation_text ⇒ Object
Returns the value of attribute confirmation_text.
-
#protected_environments ⇒ Object
Returns the value of attribute protected_environments.
Instance Method Summary collapse
- #disabled? ⇒ Boolean
- #enabled? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #set_enabled ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
66 67 68 69 70 |
# File 'lib/carefully.rb', line 66 def initialize self.protected_environments = [:production, :demo, :staging] self. = "You are performing destructive actions in #{Rails.env} environment. Do you want to continue?" self.confirmation_text = 'yes' end |
Instance Attribute Details
#confirmation_message ⇒ Object
Returns the value of attribute confirmation_message.
64 65 66 |
# File 'lib/carefully.rb', line 64 def end |
#confirmation_text ⇒ Object
Returns the value of attribute confirmation_text.
64 65 66 |
# File 'lib/carefully.rb', line 64 def confirmation_text @confirmation_text end |
#protected_environments ⇒ Object
Returns the value of attribute protected_environments.
64 65 66 |
# File 'lib/carefully.rb', line 64 def protected_environments @protected_environments end |
Instance Method Details
#disabled? ⇒ Boolean
80 81 82 |
# File 'lib/carefully.rb', line 80 def disabled? !@enabled end |
#enabled? ⇒ Boolean
76 77 78 |
# File 'lib/carefully.rb', line 76 def enabled? !!@enabled end |
#set_enabled ⇒ Object
72 73 74 |
# File 'lib/carefully.rb', line 72 def set_enabled @enabled = protected_environment? && rails_console? end |