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

+ (Object) _load(str)



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

+ (Object) yaml_new(cls, tag, val)



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

- (Object) _dump(_)



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

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

- (Object) to_yaml(opts = {})



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