Class: GLib::DateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/glib2/date-time.rb

Class Method Summary collapse

Class Method Details

.try_convert(value) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/glib2/date-time.rb', line 20

def try_convert(value)
  case value
  when ::Time
    new(year: value.year,
        month: value.month,
        day: value.day,
        hour: value.hour,
        minute: value.min,
        second: value.sec + (value.nsec / 1_000_000_000.0))
  else
    nil
  end
end