Sha256: 0c6e74251634a7bdf73535bd62f4e44ed17e323b3dc68ce96f2f6295945adc5d

Contents?: true

Size: 1.07 KB

Versions: 8

Compression:

Stored size: 1.07 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
          [:he].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

8 entries across 8 versions & 1 rubygems

Version Path
twitter_cldr-3.0.3 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.2 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.1 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-2.4.3 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.0 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-3.0.0.beta1 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-2.4.2 lib/twitter_cldr/resources/collation_tries_dumper.rb
twitter_cldr-2.4.1 lib/twitter_cldr/resources/collation_tries_dumper.rb