class Translator::SplitterLiteralDate

Public Instance Methods

map(tokens, reference_date) click to toggle source
# File lib/natural-date/translator/splitter_literal_date.rb, line 3
def map tokens, reference_date
  tokens.map do |token|
    if token.include? '/'
      translate_day_and_month(token.split('/'))
    else
      [token]
    end
  end.flatten
end

Private Instance Methods

translate_day_and_month(parts) click to toggle source
# File lib/natural-date/translator/splitter_literal_date.rb, line 15
def translate_day_and_month parts
  [ parts[0].to_i.to_s, language_bundle.months[parts[1].to_i - 1] ]
end