Sha256: 9d03090b6444aaa58386b0961669f63a243f41c06922b900d790a2b40d0d7ab7
Contents?: true
Size: 995 Bytes
Versions: 5
Compression:
Stored size: 995 Bytes
Contents
class SlimKeyfy::Transformer::BaseTransformer TRANSLATED = /t\s*\(?\s*(".*?"|'.*?')\s*\)?/ STRING = /(\".*\"|\'.*\')/ STRING_WITHOUT_QUOTES = /("(?<double_quot>.*)"|'(?<single_quot>.*)')/ def initialize(word, yaml_processor=nil) @word = word @yaml_processor = yaml_processor end def nil_elem [nil, nil] end def should_not_be_processed?(tokens) (tokens.nil? or tokens.size < 2) end def matches_string?(translation) m = translation.match(STRING_WITHOUT_QUOTES) return false if m.nil? (m[:double_quot] != nil or m[:single_quot] != nil) end def match_string(translation) m = translation.match(STRING_WITHOUT_QUOTES) return translation if m.nil? (m[:double_quot] != nil) ? m[:double_quot] : ((m[:single_quot] != nil) ? m[:single_quot] : translation) end def update_hashes(translation) @word.update_translation_key_hash(@yaml_processor, translation) end def controller? false end def slim? false end end
Version data entries
5 entries across 5 versions & 1 rubygems