Class: Imagga::RankColorParametizer

Inherits:
Object
  • Object
show all
Includes:
Parametizer
Defined in:
lib/imagga/rank_color_parametizer.rb

Instance Method Summary collapse

Methods included from Parametizer

#build_boolean_options, #build_comma_separated_string

Instance Method Details

#build_rank_color_string(rank_color) ⇒ Object



13
14
15
# File 'lib/imagga/rank_color_parametizer.rb', line 13

def build_rank_color_string(rank_color)
  "%i,%i,%i,%i" % [rank_color.percent, rank_color.r, rank_color.g, rank_color.b]
end

#build_vector(rank_color_or_colors) ⇒ Object



9
10
11
# File 'lib/imagga/rank_color_parametizer.rb', line 9

def build_vector(rank_color_or_colors)
  [rank_color_or_colors].flatten.map{ |o| build_rank_color_string(o) rescue o }.join(',')
end

#parametrize(rank_color_or_colors) ⇒ Object



5
6
7
# File 'lib/imagga/rank_color_parametizer.rb', line 5

def parametrize(rank_color_or_colors)
  { color_vector: build_vector(rank_color_or_colors) }
end