Class: Imagga::RankColor
- Inherits:
-
Object
- Object
- Imagga::RankColor
- Defined in:
- lib/imagga/image.rb
Instance Attribute Summary collapse
-
#b ⇒ Object
Returns the value of attribute b.
-
#g ⇒ Object
Returns the value of attribute g.
-
#hex ⇒ Object
Returns the value of attribute hex.
-
#percent ⇒ Object
Returns the value of attribute percent.
-
#r ⇒ Object
Returns the value of attribute r.
Instance Method Summary collapse
-
#initialize(opts) ⇒ RankColor
constructor
A new instance of RankColor.
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
#b ⇒ Object
Returns the value of attribute b.
70 71 72 |
# File 'lib/imagga/image.rb', line 70 def b @b end |
#g ⇒ Object
Returns the value of attribute g.
70 71 72 |
# File 'lib/imagga/image.rb', line 70 def g @g end |
#hex ⇒ Object
Returns the value of attribute hex.
70 71 72 |
# File 'lib/imagga/image.rb', line 70 def hex @hex end |
#percent ⇒ Object
Returns the value of attribute percent.
70 71 72 |
# File 'lib/imagga/image.rb', line 70 def percent @percent end |
#r ⇒ Object
Returns the value of attribute r.
70 71 72 |
# File 'lib/imagga/image.rb', line 70 def r @r end |