Sha256: 6697a9048fea6c2ab17a9b3cbb2a7457fac315727e24a5204a61bef784aa403e

Contents?: true

Size: 1 KB

Versions: 5

Compression:

Stored size: 1 KB

Contents

# encoding: UTF-8

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

module TwitterCldr
  module Resources
    module Properties

      class BidiBracketsPropertyImporter < PropertyImporter
        DATA_URL = 'ucd/BidiBrackets.txt'
        PROPERTY_NAME = 'Bidi_Paired_Bracket_Type'

        def initialize(input_path, database)
          super(
            input_path: input_path,
            property_name: PROPERTY_NAME,
            data_url: DATA_URL,
            data_path: File.basename(DATA_URL),
            database: database
          )
        end

        private

        def load
          super do |data, ret|
            code_points = expand_range(data[0])
            paired_bracket_type = infer_paired_bracket_type(data[2])
            ret[PROPERTY_NAME][paired_bracket_type] += code_points
          end
        end

        def infer_paired_bracket_type(str)
          TwitterCldr::Shared::Properties::BidiBrackets.bracket_types[str.upcase]
        end
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr-4.0.0 lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb
twitter_cldr-3.6.0 lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb
twitter_cldr-3.5.0 lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb
twitter_cldr-3.4.0 lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb
twitter_cldr-3.3.0 lib/twitter_cldr/resources/properties/bidi_brackets_property_importer.rb