Class: Imagga::RankColor

Inherits:
Object
  • Object
show all
Defined in:
lib/imagga/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ RankColor

Returns a new instance of RankColor.



71
72
73
74
75
76
77
78
79
80
# File 'lib/imagga/image.rb', line 71

def initialize(opts)
  @percent = opts.fetch(:percent)
  if @hex = opts[:hex]
    color = Color::RGB.from_html(@hex)
    @r, @g, @b = color.red, color.green, color.blue
  else
    @r, @g, @b = opts[:r], opts[:g], opts[:b]
    @hex = Color::RGB.new(r, g, b).html
  end
end

Instance Attribute Details

#bObject

Returns the value of attribute b.



70
71
72
# File 'lib/imagga/image.rb', line 70

def b
  @b
end

#gObject

Returns the value of attribute g.



70
71
72
# File 'lib/imagga/image.rb', line 70

def g
  @g
end

#hexObject

Returns the value of attribute hex.



70
71
72
# File 'lib/imagga/image.rb', line 70

def hex
  @hex
end

#percentObject

Returns the value of attribute percent.



70
71
72
# File 'lib/imagga/image.rb', line 70

def percent
  @percent
end

#rObject

Returns the value of attribute r.



70
71
72
# File 'lib/imagga/image.rb', line 70

def r
  @r
end