Sha256: 03bd24e61d285eef7b906c6bc8a25d2e449eede6d681d44d29321f4de1f5ee88

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

# encoding: UTF-8

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

module TwitterCldr
  module Js
    module Renderers
      module Shared

        class BreakIteratorRenderer < TwitterCldr::Js::Renderers::Base
          set_template "mustache/shared/break_iterator.coffee"

          def root_resource_data
            resource = TwitterCldr.get_resource("shared", "segments", "segments_root")
            resource.to_json
          end

          def tailoring_resource_data
            available_locales = Dir.entries(TwitterCldr::RESOURCES_DIR + "/shared/segments/tailorings").inject([]) { |ret, file|
              if file[0] != '.'
                ret << (file.chomp(File.extname(file)))
              end
              ret
            }
            resource = available_locales.inject({}) { |ret, locale|
              ret[locale] = TwitterCldr.get_resource("shared", "segments", "tailorings", locale)
              ret
            }
            resource.to_json
          end

          def exceptions_resource_data
            available_locales = Dir.entries(TwitterCldr::RESOURCES_DIR + "/uli/segments").inject([]) { |ret, file|
              if file[0] != '.'
                ret << (file.chomp(File.extname(file)))
              end
              ret
            }
            available_locales.inject({}) { |ret, locale|
              ret[locale] = TwitterCldr.get_resource("uli", "segments", locale)
              ret
            }.to_json
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr_js-2.4.0 lib/twitter_cldr/js/renderers/shared/break_iterator_renderer.rb