class Textigniter::Plugins::CreatedAt

Public Instance Methods

parse(h) click to toggle source
# File lib/textigniter/plugins/created_at.rb, line 3
def parse(h)
  # get the value to work with
  value = h['created_at']      
  # is this a valid date?
  valid = Date.parse(value) rescue false
  # if valid, pass value back
  if valid != false
    created_at = value
  # if invalid, pass nil
  else
    created_at = nil
  end
  # return the parsed value
  return created_at
end