Class: Qt::Color

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



302
303
304
305
# File 'lib/ruber/qt_sugar.rb', line 302

def self._load str
  r, g, b = str.split ';'
  self.new r.to_i, g.to_i, b.to_i
end

.yaml_new(cls, tag, val) ⇒ Object



283
284
285
286
# File 'lib/ruber/qt_sugar.rb', line 283

def self.yaml_new cls, tag, val
  r, g, b= val['red'], val['green'], val['blue']
  Qt::Color.new(r, g, b)
end

Instance Method Details

#_dump(_) ⇒ Object



298
299
300
# File 'lib/ruber/qt_sugar.rb', line 298

def _dump _
  "#{red};#{green};#{blue}"
end

#to_yaml(opts = {}) ⇒ Object



288
289
290
291
292
293
294
295
296
# File 'lib/ruber/qt_sugar.rb', line 288

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