class TwitterCldr::Shared::PropertyNameAliases

Public Class Methods

abbreviated_alias_for(long_name) click to toggle source
# File lib/twitter_cldr/shared/property_name_aliases.rb, line 12
def abbreviated_alias_for(long_name)
  index.fetch(long_name, nil)
end
aliases_for(property_name) click to toggle source
# File lib/twitter_cldr/shared/property_name_aliases.rb, line 20
def aliases_for(property_name)
  fields = (resource[property_name] || {})
  Array(fields[:long_name]) +
    Array(fields[:additional]) +
    Array(index[property_name])
end
long_alias_for(abbreviated_name) click to toggle source
# File lib/twitter_cldr/shared/property_name_aliases.rb, line 16
def long_alias_for(abbreviated_name)
  resource.fetch(abbreviated_name, {}).fetch(:long_name, nil)
end

Private Class Methods

index() click to toggle source
# File lib/twitter_cldr/shared/property_name_aliases.rb, line 29
def index
  @index ||= resource.each_with_object({}) do |(abbr_name, fields), ret|
    ret[fields[:long_name]] = abbr_name

    fields[:additional].each do |additional_alias|
      ret[additional_alias] = abbr_name
    end
  end
end
resource() click to toggle source
# File lib/twitter_cldr/shared/property_name_aliases.rb, line 39
def resource
  @resource ||=
    TwitterCldr.get_resource('unicode_data', 'property_aliases')
end