Class: Unicode::Data::Generate::PropertyValueAliases
- Inherits:
-
Object
- Object
- Unicode::Data::Generate::PropertyValueAliases
- Defined in:
- lib/unicode/data/generate.rb
Instance Attribute Summary collapse
-
#aliases ⇒ Object
readonly
Returns the value of attribute aliases.
Instance Method Summary collapse
- #find(property, value) ⇒ Object
-
#initialize(aliases) ⇒ PropertyValueAliases
constructor
A new instance of PropertyValueAliases.
- #keys ⇒ Object
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
#aliases ⇒ Object (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 |
#keys ⇒ Object
17 18 19 |
# File 'lib/unicode/data/generate.rb', line 17 def keys aliases.keys end |