File: name_alias.rb

package info (click to toggle)
ruby-unicode-utils 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 1,988 kB
  • sloc: ruby: 1,877; makefile: 4
file content (46 lines) | stat: -rw-r--r-- 861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- encoding: utf-8 -*-

module UnicodeUtils

  # See: UnicodeUtils.name_aliases
  class NameAlias

    # The alias as string.
    attr_reader :name

    # The type of alias as symbol. Currently one of :correction,
    # :control, :alternate, :figment, :abbreviation.
    attr_reader :type

    # Do not construct directly. Use UnicodeUtils.name_aliases.
    def initialize(name, type)
      @name = name
      @type = type
    end

    # Returns a descriptive string. The format may change even in minor
    # releases.
    def inspect
      "#<UnicodeUtils::NameAlias #{name} #{type.inspect}>"
    end

    # Returns name.
    def to_s
      name
    end

    def ==(other)
      other.kind_of?(NameAlias) && other.type == type && other.name == name
    end

    def eql?(other)
      self == other
    end

    def hash
      name.hash
    end

  end

end