Class: SmsValidation::Configuration
- Inherits:
-
Object
- Object
- SmsValidation::Configuration
- Defined in:
- lib/sms_validation/configuration.rb
Constant Summary collapse
- ON_MESSAGE_TOO_LONG_OPTIONS =
[:truncate, :raise_error, :split]
- LOG_LEVEL_OPTIONS =
[:fatal, :error, :warn, :info, :debug]
Instance Attribute Summary collapse
-
#log_level ⇒ Object
readonly
Returns the value of attribute log_level.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#on_message_too_long ⇒ Object
Returns the value of attribute on_message_too_long.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #log_at(level) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 20 21 |
# File 'lib/sms_validation/configuration.rb', line 17 def initialize @logger = Rails.logger if defined?(::Rails.logger) @log_level = :debug @on_message_too_long = :raise_error end |
Instance Attribute Details
#log_level ⇒ Object (readonly)
Returns the value of attribute log_level.
16 17 18 |
# File 'lib/sms_validation/configuration.rb', line 16 def log_level @log_level end |
#logger ⇒ Object
Returns the value of attribute logger.
16 17 18 |
# File 'lib/sms_validation/configuration.rb', line 16 def logger @logger end |
#on_message_too_long ⇒ Object
Returns the value of attribute on_message_too_long.
16 17 18 |
# File 'lib/sms_validation/configuration.rb', line 16 def @on_message_too_long end |
Instance Method Details
#log_at(level) ⇒ Object
28 29 30 31 |
# File 'lib/sms_validation/configuration.rb', line 28 def log_at(level) validate_logger(@logger, level) @log_level = level end |