class Dalt::Parser

Parser is used to parse the date and will return alternate text if failed

Attributes

alternate[RW]
date[RW]

Public Class Methods

new(date_string, alt: nil) click to toggle source
# File lib/dalt/parser.rb, line 6
def initialize(date_string, alt: nil)
  @date = nil
  @date_string = date_string
  @alternate = alt
end

Public Instance Methods

parse() click to toggle source
# File lib/dalt/parser.rb, line 12
def parse
  @date = Date.parse(@date_string)
rescue StandardError
  raise ::Dalt::Error::WithoutAlternate if alternate.nil?

  alternate
end