Class: TwitterCldr::Shared::PropertyValueAliases

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/shared/property_value_aliases.rb

Class Method Summary collapse

Class Method Details

.abbreviated_alias_for(property_name, property_value) ⇒ Object



12
13
14
15
16
# File 'lib/twitter_cldr/shared/property_value_aliases.rb', line 12

def abbreviated_alias_for(property_name, property_value)
  (find_index_for(property_name, property_value) || {})
    .fetch(property_value, {})
    .fetch(:abbreviated_name, nil)
end

.aliases_for(property_name, property_value) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/twitter_cldr/shared/property_value_aliases.rb', line 30

def aliases_for(property_name, property_value)
  aliases = [
    abbreviated_alias_for(property_name, property_value),
    long_alias_for(property_name, property_value),
    numeric_alias_for(property_name, property_value)
  ].compact

  aliases.delete(property_value)
  aliases
end

.long_alias_for(property_name, property_value) ⇒ Object



18
19
20
21
22
# File 'lib/twitter_cldr/shared/property_value_aliases.rb', line 18

def long_alias_for(property_name, property_value)
  (find_index_for(property_name, property_value) || {})
    .fetch(property_value, {})
    .fetch(:long_name, nil)
end

.numeric_alias_for(property_name, property_value) ⇒ Object



24
25
26
27
28
# File 'lib/twitter_cldr/shared/property_value_aliases.rb', line 24

def numeric_alias_for(property_name, property_value)
  (find_index_for(property_name, property_value) || {})
    .fetch(property_value, {})
    .fetch(:numeric, nil)
end