Class: Qt::Date

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

._load(str) ⇒ Object



331
332
333
334
# File 'lib/ruber/qt_sugar.rb', line 331

def self._load str
  y, m, d = str.split ';'
  self.new(y.to_i, m.to_i, d.to_i)
end

.yaml_new(cls, tag, val) ⇒ Object



312
313
314
315
# File 'lib/ruber/qt_sugar.rb', line 312

def self.yaml_new cls, tag, val
  y, m, d = val['year'], val['month'], val['day']
  Qt::Date.new(y, m, d)
end

Instance Method Details

#_dump(_) ⇒ Object



327
328
329
# File 'lib/ruber/qt_sugar.rb', line 327

def _dump _
  "#{year};#{month};#{day}"
end

#to_yaml(opts = {}) ⇒ Object



317
318
319
320
321
322
323
324
325
# File 'lib/ruber/qt_sugar.rb', line 317

def to_yaml opts = {}
  YAML.quick_emit(self, opts) do |out|
    out.map(taguri, to_yaml_style) do |map|
      map.add 'year', year
      map.add 'month', month
      map.add 'day', day
    end
  end
end