Class: Unicode::Data::Generate::PropertyValueAliases

Inherits:
Object
  • Object
show all
Defined in:
lib/unicode/data/generate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(aliases) ⇒ PropertyValueAliases

Returns a new instance of PropertyValueAliases.



13
14
15
# File 'lib/unicode/data/generate.rb', line 13

def initialize(aliases)
  @aliases = aliases
end

Instance Attribute Details

#aliasesObject (readonly)

Returns the value of attribute aliases.



11
12
13
# File 'lib/unicode/data/generate.rb', line 11

def aliases
  @aliases
end

Instance Method Details

#find(property, value) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/unicode/data/generate.rb', line 21

def find(property, value)
  term = value.gsub(/[- ]/, "_")

  aliases[property].find do |alias_set|
    alias_set.any? { |alias_value| alias_value.casecmp(term) == 0 }
  end
end

#keysObject



17
18
19
# File 'lib/unicode/data/generate.rb', line 17

def keys
  aliases.keys
end