Method: Moo::Model::Colour#to_hash

Defined in:
lib/moo/model/colour.rb

#to_hashObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/moo/model/colour.rb', line 58

def to_hash
  if @type == 'RGB'
    return {
      :type => 'RGB',
      :r    => @r,
      :g    => @g,
      :b    => @b
    }
  elsif @type == 'CMYK'
    return {
      :type => 'CMYK',
      :c    => @c,
      :m    => @m,
      :y    => @y,
      :k    => @k
    }
  end
end