Class: HistoricalDating::Range

Inherits:
Object
  • Object
show all
Defined in:
lib/historical_dating/range.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject (readonly)

Returns the value of attribute from.



7
8
9
# File 'lib/historical_dating/range.rb', line 7

def from
  @from
end

#toObject (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_timeObject



13
14
15
# File 'lib/historical_dating/range.rb', line 13

def from_time
  Time.mktime(from.year, from.month, from.day)
end

#julian_rangeObject



9
10
11
# File 'lib/historical_dating/range.rb', line 9

def julian_range
  [from.jd, to.jd]
end

#to_timeObject



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