Sha256: 92c56fbdc3194490a1582052cd168d88d2342d9986e21ea0afb3cdc27618ed40
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
# encoding: UTF-8 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.0.1 | lib/formatters/base.rb |