Class: Qt::Time

Inherits:
Object show all
Defined in:
lib/ruber/qt_sugar.rb

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) _load(str)



424
425
426
427
428
429
430
# File 'lib/ruber/qt_sugar.rb', line 424

def self._load str
  if str.empty? then self.new
  else
    h, m, s, ms = str.split ';'
    self.new h.to_i, m.to_i, s.to_i, ms.to_i
  end
end

+ (Object) yaml_new(cls, tag, val)



397
398
399
400
401
402
# File 'lib/ruber/qt_sugar.rb', line 397

def self.yaml_new cls, tag, val
  if val['valid']
    Qt::Time.new val['hours'], val['minutes'], val['seconds'], val['msec']
  else Qt::Time.new
  end
end

Instance Method Details

- (Object) _dump(_)



418
419
420
421
422
# File 'lib/ruber/qt_sugar.rb', line 418

def _dump _
  if valid? then "#{hour};#{minute};#{second};#{msec}"
  else ""
  end
end

- (Object) to_yaml(opts = {})



404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/ruber/qt_sugar.rb', line 404

def to_yaml opts = {}
  YAML.quick_emit(self, opts) do |out|
    out.map(taguri, to_yaml_style) do |map|
      map.add 'valid', valid?
      if valid?
        map.add 'hours', hour
        map.add 'minutes', minute
        map.add 'seconds', second
        map.add 'msec', msec
      end
    end
  end
end