Class: Qt::Rect

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



233
234
235
236
# File 'lib/ruber/qt_sugar.rb', line 233

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

.yaml_new(cls, tag, val) ⇒ Object



212
213
214
215
216
# File 'lib/ruber/qt_sugar.rb', line 212

def self.yaml_new cls, tag, val
  left, top, width, height= val['left'], val['top'], val['width'], 
      val['height']
  self.new(left, top, width, height)
end

Instance Method Details

#_dump(_) ⇒ Object



229
230
231
# File 'lib/ruber/qt_sugar.rb', line 229

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

#to_yaml(opts = {}) ⇒ Object



218
219
220
221
222
223
224
225
226
227
# File 'lib/ruber/qt_sugar.rb', line 218

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