class ExtractI18n::Slimkeyfy::JsWord
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
ExtractI18n::Slimkeyfy::Word::new
# File lib/extract_i18n/slimkeyfy/word.rb, line 71 def initialize(*args) super @use_absolute_key = true end
Public Instance Methods
extract_arguments(translation)
click to toggle source
# File lib/extract_i18n/slimkeyfy/word.rb, line 76 def extract_arguments(translation) args = {} translation.scan(/\{\{([^}]*)\}\}/).each_with_index do |stripped_arg, index| arg = Regexp.last_match[0] key = arg[/\w+/] key += index.to_s if index > 0 translation = translation.gsub(arg, "{#{key}}") args[key] = stripped_arg[0] end [args, translation] end