Class: RfLogger::ErrorNotification::EnvironmentConstraints
- Inherits:
-
Object
- Object
- RfLogger::ErrorNotification::EnvironmentConstraints
- Defined in:
- lib/rf_logger/notifications/error_notification_environment_constraints.rb
Instance Method Summary collapse
- #excluded? ⇒ Boolean
- #included? ⇒ Boolean
-
#initialize(environment, constraints = {}) ⇒ EnvironmentConstraints
constructor
A new instance of EnvironmentConstraints.
- #valid_notifier? ⇒ Boolean
Constructor Details
#initialize(environment, constraints = {}) ⇒ EnvironmentConstraints
Returns a new instance of EnvironmentConstraints.
4 5 6 7 |
# File 'lib/rf_logger/notifications/error_notification_environment_constraints.rb', line 4 def initialize(environment, constraints={}) @constraints = constraints @environment = environment end |
Instance Method Details
#excluded? ⇒ Boolean
18 19 20 21 22 |
# File 'lib/rf_logger/notifications/error_notification_environment_constraints.rb', line 18 def excluded? except = @constraints[:except] return false if except.nil? except.include?(@environment) end |
#included? ⇒ Boolean
13 14 15 16 |
# File 'lib/rf_logger/notifications/error_notification_environment_constraints.rb', line 13 def included? only = @constraints[:only] only.nil? || only.include?(@environment) end |
#valid_notifier? ⇒ Boolean
9 10 11 |
# File 'lib/rf_logger/notifications/error_notification_environment_constraints.rb', line 9 def valid_notifier? @constraints.nil? || (included? && !excluded?) end |