Module: TZInfo::RubyCoreSupport
- Defined in:
- lib/tzinfo/ruby_core_support.rb
Overview
Methods to support different versions of Ruby.
Constant Summary collapse
- HALF_DAYS_IN_DAY =
rational_new!(1, 2)
Class Method Summary collapse
- .datetime_new(y = -4712,, m = 1, d = 1, h = 0, min = 0, s = 0, of = 0, sg = Date::ITALY) ⇒ Object
- .datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) ⇒ Object
- .force_encoding(str, encoding) ⇒ Object
- .rational_new!(numerator, denominator = 1) ⇒ Object
- .time_nsec(time) ⇒ Object
Class Method Details
.datetime_new(y = -4712,, m = 1, d = 1, h = 0, min = 0, s = 0, of = 0, sg = Date::ITALY) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/tzinfo/ruby_core_support.rb', line 84 def self.datetime_new(y=-4712, m=1, d=1, h=0, min=0, s=0, of=0, sg=Date::ITALY) if !s.kind_of?(Integer) && s > 59 dt = DateTime.new(y, m, d, h, min, 59, of, sg) dt + (s - 59) / 86400 else DateTime.new(y, m, d, h, min, s, of, sg) end end |
.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) ⇒ Object
50 51 52 |
# File 'lib/tzinfo/ruby_core_support.rb', line 50 def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) DateTime.new!(ajd, of, sg) end |
.force_encoding(str, encoding) ⇒ Object
143 144 145 |
# File 'lib/tzinfo/ruby_core_support.rb', line 143 def self.force_encoding(str, encoding) str.force_encoding(encoding) end |
.rational_new!(numerator, denominator = 1) ⇒ Object
34 35 36 |
# File 'lib/tzinfo/ruby_core_support.rb', line 34 def self.rational_new!(numerator, denominator = 1) Rational.new!(numerator, denominator) end |
.time_nsec(time) ⇒ Object
131 132 133 |
# File 'lib/tzinfo/ruby_core_support.rb', line 131 def self.time_nsec(time) time.nsec end |