Class: Qt::Size

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



165
166
167
168
# File 'lib/ruber/qt_sugar.rb', line 165

def self._load str
  w, h = str.split ';'
  self.new w.to_i, h.to_i
end

.yaml_new(cls, tag, val) ⇒ Object



147
148
149
150
# File 'lib/ruber/qt_sugar.rb', line 147

def self.yaml_new cls, tag, val
  width, height= val['width'], val['height']
  Qt::Size.new(width, height)
end

Instance Method Details

#_dump(_) ⇒ Object



161
162
163
# File 'lib/ruber/qt_sugar.rb', line 161

def _dump _
  "#{width};#{height}"
end

#to_yaml(opts = {}) ⇒ Object



152
153
154
155
156
157
158
159
# File 'lib/ruber/qt_sugar.rb', line 152

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