method
new_by_frags
Ruby latest stable (v2_5_5)
-
0 notes -
Class: DateTime
- 1_8_6_287 (0)
- 1_8_7_72 (0)
- 1_8_7_330 (0)
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125
- 1_9_3_392
- 2_1_10
- 2_2_9
- 2_4_6
- 2_5_5
- 2_6_3
- What's this?
new_by_frags(elem, sg)
private
Hide source
# File lib/date.rb, line 1683 def self.new_by_frags(elem, sg) # :nodoc: elem = rewrite_frags(elem) elem = complete_frags(elem) unless (jd = valid_date_frags?(elem, sg)) && (fr = valid_time_frags?(elem)) raise ArgumentError, 'invalid date' end fr += (elem[:sec_fraction] || 0) / 86400 of = Rational(elem[:offset] || 0, 86400) new!(jd_to_ajd(jd, fr, of), of, sg) end