Sha256: ae0deb018dfe61e11c70292f864352da40e39478de201d8152957455b0d8bd78
Contents?: true
Size: 632 Bytes
Versions: 22
Compression:
Stored size: 632 Bytes
Contents
module Babelyoda module Regexp PLURAL_ID = /([^%]|^)%\[(one|some|many|none|plural)\]([^\s])/ PLURALIZED_ID = /([^%]|^)%\[(plural)\]([^\s])/ def plural_id?(id) plural_match(id) != nil end def plural_match(id) id.match(PLURAL_ID) end def depluralize_value(id) id.gsub(PLURAL_ID, '\1%\3') end def depluralize_key(id) id.gsub(PLURAL_ID, '\1%[plural]\3') end def pluralize_key(id, plural_key) id.gsub(PLURALIZED_ID, "\\1%[#{plural_key}]\\3") end def extract_plural_key(id) id.match(PLURAL_ID)[2].to_sym end end end
Version data entries
22 entries across 22 versions & 1 rubygems