Sha256: 2c137efea1ded23dacf1ecd540cba9851d05aab936b9ba3a3e2518df07f8d29c

Contents?: true

Size: 651 Bytes

Versions: 2

Compression:

Stored size: 651 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

module TwitterCldr
  module Shared
    class Resources
      def initialize
        @resources_by_locale = Hash.new do |hash, locale|
          hash[locale] = Hash.new { |h, resource| h[resource] = data_for(locale, resource) }
        end
      end

      def resource_for(locale, resource)
        @resources_by_locale[locale.to_sym][resource]
      end

      protected

      def data_for(locale, resource)
        TwitterCldr::Utils.deep_symbolize_keys(YAML.load(File.read(TwitterCldr.get_resource_file(locale, resource))))
      end

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter_cldr-1.2.0 lib/twitter_cldr/shared/resources.rb
twitter_cldr-1.1.0 lib/shared/resources.rb