Exception: RockBooks::DateRangeError
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- RockBooks::DateRangeError
- Defined in:
- lib/rock_books/errors/date_range_error.rb
Instance Attribute Summary collapse
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#extra_string ⇒ Object
readonly
Returns the value of attribute extra_string.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
Instance Method Summary collapse
-
#initialize(date, start_date, end_date, extra_string = nil) ⇒ DateRangeError
constructor
A new instance of DateRangeError.
- #to_s ⇒ Object
Constructor Details
#initialize(date, start_date, end_date, extra_string = nil) ⇒ DateRangeError
Returns a new instance of DateRangeError.
6 7 8 9 10 11 |
# File 'lib/rock_books/errors/date_range_error.rb', line 6 def initialize(date, start_date, end_date, extra_string = nil) @date = date @start_date = start_date @end_date = end_date @extra_string = extra_string end |
Instance Attribute Details
#date ⇒ Object (readonly)
Returns the value of attribute date.
4 5 6 |
# File 'lib/rock_books/errors/date_range_error.rb', line 4 def date @date end |
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
4 5 6 |
# File 'lib/rock_books/errors/date_range_error.rb', line 4 def end_date @end_date end |
#extra_string ⇒ Object (readonly)
Returns the value of attribute extra_string.
4 5 6 |
# File 'lib/rock_books/errors/date_range_error.rb', line 4 def extra_string @extra_string end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
4 5 6 |
# File 'lib/rock_books/errors/date_range_error.rb', line 4 def start_date @start_date end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rock_books/errors/date_range_error.rb', line 13 def to_s s = "#{date} is not within this data set's period of #{start_date} to #{end_date}" s << " (#{extra_string})" if extra_string s << '.' s end |