class RGBUtils::RGBToHexConverter
Attributes
color[R]
Public Class Methods
new(color)
click to toggle source
# File lib/rgb_utils/converters/rgb_to_hex_converter.rb, line 3 def initialize(color) @color = color end
Public Instance Methods
convert()
click to toggle source
# File lib/rgb_utils/converters/rgb_to_hex_converter.rb, line 7 def convert WebSafeToHexConverter.convert(hex_color) end
Private Instance Methods
hex_color()
click to toggle source
# File lib/rgb_utils/converters/rgb_to_hex_converter.rb, line 15 def hex_color @hex_color ||= begin return color unless color.is_a?(RGB) [color.red, color.green, color.blue].map do |color_node| '%02x' % color_node end.join end end