Class: UnicodeUtils::NameAlias
- Inherits:
-
Object
- Object
- UnicodeUtils::NameAlias
- Defined in:
- lib/unicode_utils/name_alias.rb
Overview
See: UnicodeUtils.name_aliases
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
The alias as string.
-
#type ⇒ Object
readonly
The type of alias as symbol.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, type) ⇒ NameAlias
constructor
Do not construct directly.
-
#inspect ⇒ Object
Returns a descriptive string.
-
#to_s ⇒ Object
Returns name.
Constructor Details
#initialize(name, type) ⇒ NameAlias
Do not construct directly. Use UnicodeUtils.name_aliases.
16 17 18 19 |
# File 'lib/unicode_utils/name_alias.rb', line 16 def initialize(name, type) @name = name @type = type end |
Instance Attribute Details
#name ⇒ Object (readonly)
The alias as string.
9 10 11 |
# File 'lib/unicode_utils/name_alias.rb', line 9 def name @name end |
#type ⇒ Object (readonly)
The type of alias as symbol. Currently one of :correction, :control, :alternate, :figment, :abbreviation.
13 14 15 |
# File 'lib/unicode_utils/name_alias.rb', line 13 def type @type end |
Instance Method Details
#==(other) ⇒ Object
32 33 34 |
# File 'lib/unicode_utils/name_alias.rb', line 32 def ==(other) other.kind_of?(NameAlias) && other.type == type && other.name == name end |
#eql?(other) ⇒ Boolean
36 37 38 |
# File 'lib/unicode_utils/name_alias.rb', line 36 def eql?(other) self == other end |
#hash ⇒ Object
40 41 42 |
# File 'lib/unicode_utils/name_alias.rb', line 40 def hash name.hash end |
#inspect ⇒ Object
Returns a descriptive string. The format may change even in minor releases.
23 24 25 |
# File 'lib/unicode_utils/name_alias.rb', line 23 def inspect "#<UnicodeUtils::NameAlias #{name} #{type.inspect}>" end |
#to_s ⇒ Object
Returns name.
28 29 30 |
# File 'lib/unicode_utils/name_alias.rb', line 28 def to_s name end |