Class: Color::RGB::JP::Base::ColorName
- Inherits:
-
Object
- Object
- Color::RGB::JP::Base::ColorName
- Includes:
- Encode
- Defined in:
- lib/color/rgb/jp/base/color_name.rb
Constant Summary
Constants included from Encode
Instance Attribute Summary collapse
-
#const_name ⇒ Object
readonly
Returns the value of attribute const_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(const_name, kanji, hiragana, katakana = nil, romaji = nil) ⇒ ColorName
constructor
A new instance of ColorName.
- #names(encoding = Encode::INTERNAL_ENCODING) ⇒ Object (also: #to_a)
- #to_s ⇒ Object
Methods included from Encode
encode_to, with_internal_encoding
Constructor Details
#initialize(const_name, kanji, hiragana, katakana = nil, romaji = nil) ⇒ ColorName
Returns a new instance of ColorName.
21 22 23 24 25 26 27 |
# File 'lib/color/rgb/jp/base/color_name.rb', line 21 def initialize(const_name, kanji, hiragana, katakana = nil, romaji = nil) @const_name = const_name @kanji = kanji @hiragana = hiragana @katakana = katakana @romaji = romaji end |
Instance Attribute Details
#const_name ⇒ Object (readonly)
Returns the value of attribute const_name.
19 20 21 |
# File 'lib/color/rgb/jp/base/color_name.rb', line 19 def const_name @const_name end |
Class Method Details
.encoded_attr_reader(internal_encoding, *attributes) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/color/rgb/jp/base/color_name.rb', line 8 def self.encoded_attr_reader(internal_encoding, *attributes) attributes.each do |attr| class_eval %Q{ def #{attr}(encoding = "#{internal_encoding}") encode_to(encoding, "#{internal_encoding}", @#{attr}) end } end end |
Instance Method Details
#names(encoding = Encode::INTERNAL_ENCODING) ⇒ Object Also known as: to_a
33 34 35 |
# File 'lib/color/rgb/jp/base/color_name.rb', line 33 def names(encoding = Encode::INTERNAL_ENCODING) %W(kanji hiragana katakana romaji).map{|e| self.__send__(e, encoding) } end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/color/rgb/jp/base/color_name.rb', line 29 def to_s romaji end |