public
Description: natural language date and time parser, and message extractor
Homepage: naturalinputs.com
Clone URL: git://github.com/lzell/nickel.git
nickel /
name age message
file .gitignore Loading commit data...
file History.txt
file License.txt
file README.rdoc
directory lib/
file nickel.gemspec
directory test/
README.rdoc

Nickel is a client for Natural Inputs

Install

  gem install lzell-nickel

Usage

A single occurrence

  n = Nickel.query "lunch tomorrow with maria"
  n.message                       # => lunch with maria
  n.occurrences[0].type           # => single
  n.occurrences[0].start_date     # => 20090323

A daily occurrence

  n = Nickel.query "wake up everyday at 11am"
  n.message                       # => wake up
  n.occurrences[0].type           # => daily
  n.occurrences[0].start_time     # => 11:00:00

A weekly occurrence

  n = Nickel.query "guitar lessons every tuesday at 5pm"
  n.message                       # => guitar lessons
  n.occurrences[0].type           # => weekly
  n.occurrences[0].day_of_week    # => tue
  n.occurrences[0].interval       # => 1
  n.occurrences[0].start_time     # => 17:00:00

A day monthly occurrence

  n = Nickel.query "drink specials on the second thursday of every month"
  n.message                       # => drink specials
  n.occurrences[0].type           # => daymonthly
  n.occurrences[0].day_of_week    # => thu
  n.occurrences[0].week_of_month  # => 2
  n.occurrences[0].interval       # => 1

A date monthly occurrence

  n = Nickel.query "pay credit card every month on the 22nd"
  n.message                       # => pay credit card
  n.occurrences[0].type           # => datemonthly
  n.occurrences[0].date_of_month  # => 22
  n.occurrences[0].interval       # => 1

Multiple occurrences

  n = Nickel.query "band meeting every monday and wednesday at 2pm"
  n.message                       # => band meeting
  n.occurrences[0].type           # => weekly
  n.occurrences[0].day_of_week    # => mon
  n.occurrences[0].start_time     # => 14:00:00
  n.occurrences[1].type           # => weekly
  n.occurrences[1].day_of_week    # => wed
  n.occurrences[1].start_time     # => 14:00:00