Class: HistoricalDating::Range
- Inherits:
-
Object
- Object
- HistoricalDating::Range
- Defined in:
- lib/historical_dating/range.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #from_time ⇒ Object
-
#initialize(from, to) ⇒ Range
constructor
A new instance of Range.
- #julian_range ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize(from, to) ⇒ Range
Returns a new instance of Range.
2 3 4 5 |
# File 'lib/historical_dating/range.rb', line 2 def initialize(from, to) @from = from @to = to end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
7 8 9 |
# File 'lib/historical_dating/range.rb', line 7 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
7 8 9 |
# File 'lib/historical_dating/range.rb', line 7 def to @to end |
Instance Method Details
#from_time ⇒ Object
13 14 15 |
# File 'lib/historical_dating/range.rb', line 13 def from_time Time.mktime(from.year, from.month, from.day) end |
#julian_range ⇒ Object
9 10 11 |
# File 'lib/historical_dating/range.rb', line 9 def julian_range [from.jd, to.jd] end |
#to_time ⇒ Object
17 18 19 |
# File 'lib/historical_dating/range.rb', line 17 def to_time Time.mktime(to.year, to.month, to.day, 23, 59, 59) end |