chronic
https://github.com/mojombo/chronic
Ruby
Chronic is a pure Ruby natural language date parser.
Chronic::Tag.match_item
Internal: Match item and create respective Tag class.
When item is a Symbol it will match only when it's identical to Token.
When it's a String it will case-insesitively match partial token,
but only if item's last char have different type than token text's next char.
When item is a Regexp it will match by it.
item - Item to match. It can be String, Symbol or Regexp.
klass - Tag class to create.
symbol - Tag type as symbol or string to pass to Tag class.
token - Token to match against.
options - Options as hash to pass to Tag class.
Returns an instance of specified Tag klass or nil if item didn't match.Edit
git clone [email protected]:mojombo/chronic.git
cd chronic
open lib/chronic/tag.rb
Contribute
# Make a new branchgit checkout -b -your-name--update-docs-Chronic--Tag-match_item-for-pr
# Commit to gitgit add lib/chronic/tag.rbgit commit -m "better docs for Chronic::Tag.match_item"
# Open pull requestgem install hub # on a mac you can `brew install hub`
hub fork
git push <your name> -your-name--update-docs-Chronic--Tag-match_item-for-pr
hub pull-request
# Celebrate!