Class: Carefully::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/carefully.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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.confirmation_message   = "You are performing destructive actions in #{Rails.env} environment. Do you want to continue?"
  self.confirmation_text      = 'yes'
end

Instance Attribute Details

#confirmation_messageObject

Returns the value of attribute confirmation_message.



64
65
66
# File 'lib/carefully.rb', line 64

def confirmation_message
  @confirmation_message
end

#confirmation_textObject

Returns the value of attribute confirmation_text.



64
65
66
# File 'lib/carefully.rb', line 64

def confirmation_text
  @confirmation_text
end

#protected_environmentsObject

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

Returns:

  • (Boolean)


80
81
82
# File 'lib/carefully.rb', line 80

def disabled?
  !@enabled
end

#enabled?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/carefully.rb', line 76

def enabled?
  !!@enabled
end

#set_enabledObject



72
73
74
# File 'lib/carefully.rb', line 72

def set_enabled
  @enabled = protected_environment? && rails_console?
end