Class: PrawnRougeFormatter::NormalizeColor

Inherits:
Object
  • Object
show all
Defined in:
lib/prawn_rouge_formatter/normalize_color.rb

Class Method Summary collapse

Class Method Details

.fetch(code) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/prawn_rouge_formatter/normalize_color.rb', line 3

def self.fetch(code)
  return unless code

  normalized = (code.start_with? '#') ? code[1..-1] : code
  normalized = normalized.each_char.map {|c| c * 2 }.join if normalized.length == 3
  normalized
end