Skip to content

Commit

Permalink
refactor utility functions; code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexduryee committed Dec 30, 2015
1 parent 152aa65 commit f2dcc54
Show file tree
Hide file tree
Showing 5 changed files with 334 additions and 306 deletions.
3 changes: 2 additions & 1 deletion lib/timetwister.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require "timetwister/version"
require "timetwister/parser"
require "timetwister/utilities"

module Timetwister

Expand All @@ -13,7 +14,7 @@ def self.parse(str, options={})

# check for dates of form "Month Day(-Day), Year" before splitting on commas
# (removes certainty markers as to not jam the regex)
if Parser.replace_ordinals(conj).gsub(/[\?\[\]]/, '').match(/[a-z]*\.?\s[0-9]{1,2}(\s?-[0-9]{1,2})?\,\s[0-9]{4}/i)
if Utilities.replace_ordinals(conj).gsub(/[\?\[\]]/, '').match(/[a-z]*\.?\s[0-9]{1,2}(\s?-[0-9]{1,2})?\,\s[0-9]{4}/i)
out << Parser.string_to_dates(conj, options)
else
conj.split(',').each do |comma|
Expand Down

0 comments on commit f2dcc54

Please sign in to comment.