Sha256: 71ac0c3f5410c0a49ea156ad2ffec68ae033fa56333a65414090b63d16736293

Contents?: true

Size: 1.05 KB

Versions: 31

Compression:

Stored size: 1.05 KB

Contents

# encoding: UTF-8

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

module TwitterCldr
  module Resources

    module CollationTriesDumper

      class << self

        def update_dumps
          update_default_trie_dump
          TwitterCldr.supported_locales.each { |locale| update_tailoring_trie_dump(locale) }
        end

        private

        def update_default_trie_dump
          save_trie_dump(TwitterCldr::Collation::TrieLoader::DEFAULT_TRIE_LOCALE, default_trie)
        end

        def update_tailoring_trie_dump(locale)
          save_trie_dump(locale, TwitterCldr::Collation::TrieBuilder.load_tailored_trie(locale, @default_trie))
        end

        def save_trie_dump(locale, trie)
          path = TwitterCldr::Collation::TrieLoader.dump_path(locale)
          FileUtils.mkdir_p(File.dirname(path))

          File.open(path, 'w') { |f| f.write(Marshal.dump(trie)) }
        end

        def default_trie
          @default_trie ||= TwitterCldr::Collation::TrieBuilder.load_default_trie
        end
      end

    end

  end
end

Version data entries

31 entries across 31 versions & 2 rubygems

Version Path
twitter_cldr-4.0.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.6.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.5.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.4.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.3.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/twitter_cldr-3.2.1/lib/twitter_cldr/resources/collation_tries_dumper.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/twitter_cldr-3.2.1/lib/twitter_cldr/resources/collation_tries_dumper.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/twitter_cldr-3.1.2/lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.2.1 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.2.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.1.2 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.1.1 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.1.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.10 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.9 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.8 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.7 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.6 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.5 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.4 lib/twitter_cldr/resources/collation_tries_dumper.rb