Module: Color::RGB::JP::Base::Encode

Included in:
ColorName, Pallet
Defined in:
lib/color/rgb/jp/base/encode.rb

Constant Summary collapse

INTERNAL_ENCODING =
"UTF-8"

Class Method Summary collapse

Class Method Details

.encode_to(to, from, value) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/color/rgb/jp/base/encode.rb', line 10

def encode_to(to, from, value)
  return nil if value.nil?
  return value if to.nil?
  return value if from.nil?
  return value if from == to
  return Iconv.iconv(to, from, value)[0]
end

.with_internal_encoding(value, from) {|encode_to(INTERNAL_ENCODING, from, value)| ... } ⇒ Object

Yields:



18
19
20
# File 'lib/color/rgb/jp/base/encode.rb', line 18

def with_internal_encoding(value, from)
  yield encode_to(INTERNAL_ENCODING, from, value)
end