Module: TimeCrisis::TZInfo::RubyCoreSupport

Defined in:
lib/time_crisis/tzinfo/ruby_core_support.rb

Overview

Methods to support different versions of Ruby.

Class Method Summary collapse

Class Method Details

.datetime_new!(ajd = 0, offset = 0, sg = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/time_crisis/tzinfo/ruby_core_support.rb', line 21

def self.datetime_new!(ajd = 0, offset = 0, sg = nil)
  if offset < 0
    offset = 1 + offset
  end

  jd, fract = (ajd + offset + Rational(1, 2)).divmod(1)

  ::TimeCrisis::DateTime.jd_fract(jd.to_i, fract.to_f)
end

.rational_new!(numerator, denominator = 1) ⇒ Object



12
13
14
# File 'lib/time_crisis/tzinfo/ruby_core_support.rb', line 12

def self.rational_new!(numerator, denominator = 1)
  Rational.new!(numerator, denominator)
end