Sha256: 5fd4e9d3816026c2213781d9dc0b527299e9d0947e70a59e27f0a012b5229be8

Contents?: true

Size: 1.05 KB

Versions: 5

Compression:

Stored size: 1.05 KB

Contents

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

class TwitterCldr.CharacterSet extends TwitterCldr.Component
  constructor : (text) ->
    name_parts = text.split("=")
    if name_parts.length == 2
      @property = name_parts[0].toLowerCase()
      @property_value = name_parts[1]
    else
      @property_value = text
      @property = null

  to_regexp_str : ->
    @set_to_regex(@to_set())

  to_set : ->
    @codepoints().subtract(
      TwitterCldr.UnicodeRegex.get_unsupported_chars()
    ).subtract(
      TwitterCldr.UnicodeRegex.get_invalid_regexp_chars()
    )

  codepoints : ->
    if @property?
      method = "code_points_for_" + @property
      ranges = TwitterCldr.CodePoint.code_points_for_property(@property, @property_value)

      if ranges?
        new TwitterCldr.RangeSet(ranges)
      else
        throw "Couldn't find property " + @property + " containing property value " + @property_value
    else
      new TwitterCldr.RangeSet(
        TwitterCldr.CodePoint.code_points_for_property_value(@property_value)
      )

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
twitter_cldr_js-3.3.0 lib/twitter_cldr/js/mustache/implementation/parsers/unicode_regex/character_set.coffee
twitter_cldr_js-3.2.0 lib/twitter_cldr/js/mustache/implementation/parsers/unicode_regex/character_set.coffee
twitter_cldr_js-3.1.1 lib/twitter_cldr/js/mustache/implementation/parsers/unicode_regex/character_set.coffee
twitter_cldr_js-3.1.0 lib/twitter_cldr/js/mustache/implementation/parsers/unicode_regex/character_set.coffee
twitter_cldr_js-2.4.0 lib/twitter_cldr/js/mustache/parsers/unicode_regex/character_set.coffee