Sha256: e4229c75d3efe2152ca35e70e763c0e85313ebccce36602c04454d7cfe9200ee
Contents?: true
Size: 953 Bytes
Versions: 1
Compression:
Stored size: 953 Bytes
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Formatters class Base attr_reader :tokenizer def format(obj, options = {}) final = StringIO.new result = self.get_tokens(obj, options).each_with_index do |token, index| case token.type when :pattern final << self.result_for_token(token, index, obj) else if token.value.size > 0 && token.value[0].chr == "'" && token.value[-1].chr == "'" final << token.value[1..-2] else final << token.value end end end final.string end protected def get_tokens(obj, options = {}) @tokenizer.tokens(options) end def extract_locale(options) options[:locale] || TwitterCldr::DEFAULT_LOCALE end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
twitter_cldr-1.1.0 | lib/formatters/base.rb |