Exception: EventCounter::CounterError
- Inherits:
-
StandardError
- Object
- StandardError
- EventCounter::CounterError
- Defined in:
- lib/event_counter.rb
Overview
Default error class
Constant Summary collapse
- MESSAGES =
{ not_found: 'Unable to find counter (%{name}).', direction: 'Wrong direction for counter.' \ 'Possible values are :up and :down as symbols.', less: 'Specified interval (%{interval}) could not be less then ' \ 'a defined (%{default_interval}) in a countable model (%{model}).', multiple: 'Specified interval (%{interval}) should be a multiple of ' \ 'a defined (%{default_interval}) in a countable model (%{model}).', time_zone: 'The :on_time option should be defined with time zone, e.x.: ' \ 'Time.zone.local(2014, 1, 1, 1, 1)' }
Instance Attribute Summary collapse
-
#extra ⇒ Object
Returns the value of attribute extra.
Instance Method Summary collapse
-
#initialize(*args) ⇒ CounterError
constructor
A new instance of CounterError.
- #to_s ⇒ Object
Constructor Details
#initialize(*args) ⇒ CounterError
Returns a new instance of CounterError.
121 122 123 124 |
# File 'lib/event_counter.rb', line 121 def initialize(*args) @msg, self.extra = args.flatten! super(@msg) end |
Instance Attribute Details
#extra ⇒ Object
Returns the value of attribute extra.
119 120 121 |
# File 'lib/event_counter.rb', line 119 def extra @extra end |
Instance Method Details
#to_s ⇒ Object
126 127 128 |
# File 'lib/event_counter.rb', line 126 def to_s @msg.is_a?(Symbol) ? MESSAGES[@msg] % extra : super end |