Class: UnicodeUtils::NameAlias

Inherits:
Object
  • Object
show all
Defined in:
lib/unicode_utils/name_alias.rb

Overview

See: UnicodeUtils.name_aliases

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

The alias as string.


9
10
11
# File 'lib/unicode_utils/name_alias.rb', line 9

def name
  @name
end

#typeObject (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

Returns:

  • (Boolean)

36
37
38
# File 'lib/unicode_utils/name_alias.rb', line 36

def eql?(other)
  self == other
end

#hashObject


40
41
42
# File 'lib/unicode_utils/name_alias.rb', line 40

def hash
  name.hash
end

#inspectObject

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_sObject

Returns name.


28
29
30
# File 'lib/unicode_utils/name_alias.rb', line 28

def to_s
  name
end