Method: ActiveScaffold::Finder::ClassMethods#translate_days_and_months

Defined in:
lib/active_scaffold/finder.rb

#translate_days_and_months(value, format) ⇒ Object



239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/active_scaffold/finder.rb', line 239

def translate_days_and_months(value, format)
  translated = ''
  tables_for_translating_days_and_months(format).each do |table|
    regexp = Regexp.union(table.keys)
    index = value.index(regexp)
    next unless index
    translated << value.slice!(0...index)
    value.sub!(regexp) do |str|
      translated << table[str]
      ''
    end
  end
  translated << value
end