Class: Qt::Point

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



99
100
101
102
# File 'lib/ruber/qt_sugar.rb', line 99

def self._load str
  x, y = str.split ';'
  self.new x.to_i, y.to_i
end

.yaml_new(cls, tag, val) ⇒ Object



81
82
83
84
# File 'lib/ruber/qt_sugar.rb', line 81

def self.yaml_new cls, tag, val
  x, y= val['x'], val['y']
  Qt::Point.new(x, y)
end

Instance Method Details

#_dump(_) ⇒ Object



95
96
97
# File 'lib/ruber/qt_sugar.rb', line 95

def _dump _
  "#{x};#{self.y}"
end

#to_yaml(opts = {}) ⇒ Object



86
87
88
89
90
91
92
93
# File 'lib/ruber/qt_sugar.rb', line 86

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