• Stars
    star
    27
  • Rank 875,308 (Top 18 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 13 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A natural language parser for validating complex date ranges

Chronic Between

A simple Ruby natural language parser for date and time ranges. (For example, Mon-Fri 09:00-16:30, etc.) Returns a boolean result.

Several date and time ranges can be supplied with matching patterns being separated by a comma.

Installation

$ sudo gem sources -a http://gemcutter.org
$ sudo gem install chronic_between

Usage

>> s = 'Mon-Fri 9:00-16:30, Saturday, Sunday'
>> c = ChronicBetween.new(s)

>> DateTime.now      
=> #<DateTime: 2011-03-26T16:54:40+00:00

>> c.within? DateTime.now
=> true

>> c.within? DateTime.parse("28-Mar-2011 14:33")
=> true

>> c.within? DateTime.parse("28-Mar-2011 08:33")
=> false

Examples of parse-able strings:

  • 'Mon-Fri 9:00-16:30'
  • 'saturday'
  • '12:00-13:00'
  • 'Sat,Sun'
  • 'Mon-Fri 9:00-16:30, Saturday, Sunday'
  • 'Mon-Fri 9:00-16:30, Saturday, 10:15-10:45'
  • 'Sat 18:15-21:40'
  • 'Mon-Wed'
  • 'Mon-Fri 9:00 to 16:30'
  • '9:00-16:30 Mon-Fri'
  • '9:00 to 16:30 Mon-Fri'
  • '3:45 to 5:15'
  • 'Mon 3:45 to 5:15'
  • '3:45-5:15 Mon'
  • '3:45 to 5:15 Mon'
  • 'after 6pm'
  • 'before 9pm'
  • 'April 2nd - April 5th 12:00-14:00'
  • 'April 5th - April 9th'
  • 'April 5th'
  • 'not before 6pm'
  • 'except after 6pm'
  • 'Sunday, after 6pm'
  • 'Saturday, not after 6pm'

More Repositories

1

easter

Returns the date for Easter
Ruby
6
star
2

simple_wiimote

Create and handle events from the WiiMote with simplicity
Ruby
6
star
3

acronym

Designed for building a 3 letter acronym from a list of phrases
Ruby
5
star
4

xml-to-haml

xml-to-haml converts an XML string to HAML
Ruby
5
star
5

chronic_cron

Parses a cron entry and returns the earliest date the job would run.
Ruby
5
star
6

syllables

Count the no. of syllables in a string
Ruby
3
star
7

martile

Convert Martile (a subset of Markdown + Textile) to HTML
Ruby
3
star
8

simplepubsub

A messaging system similar to MQTT.
Ruby
3
star
9

magickcam

magickcam = rb_webcam + rmagick
Ruby
3
star
10

xml-purifier

Purifies XML from embedded JSON within an XML document.
Ruby
3
star
11

jsonx

Transform JSON into JSONx
Ruby
3
star
12

pretty-xml

Format XML to make it pretty. Dependencies: Nokogiri
Ruby
3
star
13

rot13

ROT13 is a simple letter substitution cipher; http://en.wikipedia.org/wiki/ROT13
Ruby
2
star
14

polyrex-calendar

Generate an HTML or XML calendar from a polyrex document
Ruby
2
star
15

myweatherforecast

This gem is a wrapper of the forecast_io gem.
Ruby
2
star
16

dynarex-daily

Dynarex files are archived on a daily basis. Ideal for a time recording system.
Ruby
2
star
17

hlt

HTML Line Tree turns any text in Line Tree format into a pretty HTML document
Ruby
2
star
18

cron_format

Converts a cron expression into time.
Ruby
2
star
19

gtk2svg

Experimental gem to render SVG using GTK2
Ruby
2
star
20

cronspeak

Translates a Cron expression into natural language.
Ruby
2
star
21

easyaudio_utils

A wrapper for various command-line audio utilities under GNU/Linux.
Ruby
2
star
22

morsecode

Read or write morse code with the morsecode gem
Ruby
2
star
23

dynarex

Open Dynarex files to read summary and records data as a hash
Ruby
2
star
24

run_every

Runs a block of code every n number of seconds or minutes
Ruby
2
star
25

rexle-builder

Create XML using the method + block layout of ruby.
Ruby
2
star
26

line-tree

Line-tree parses indented lines of text and returns an array of the represented tree structure.
Ruby
2
star
27

nmea_parser

Parse NMEA strings
Ruby
2
star
28

easyvideo_utils

A wrapper for ffmpeg to make basic video editing easier.
Ruby
2
star
29

Sinatra-Rscript

Sinatra-Rscript is a Sinatra application which executes Ruby Scripting Files (RSF).
Ruby
2
star
30

mindmapdoc

Transforms a markdown document into a mindmap or a mindmap into a markdown document
Ruby
2
star
31

xparams

Converts a ProjectX xml parameter list to a hash.
Ruby
2
star
32

pollyspeech

A wrapper of the aws-sdk-polly gem which caches audio files locally. Defaults to a British voice and OGG format.
Ruby
2
star
33

table-formatter

Format a table in plain text format from a 2 dimensional array.
Ruby
2
star
34

polyrex-xslt

Used internally by Polyrex to generate and XSLT document from an XSLT schema.
Ruby
2
star
35

robotic-arm

Controls the ROBOTIC ARM wtih USB PC Interface purchased from Maplin
Ruby
2
star
36

mymedia

Makes publishing to the web easier
Ruby
1
star
37

rxfreadwrite

Read and write files from remote locations (using the DFS protocol) as well as local.
Ruby
1
star
38

gems_deplevel

Returns the dependency depth level for a gem's transitive dependencies
Ruby
1
star
39

polyrex

A flavour of XML for storing and retrieveing records in a Polyrex hierarchy
Ruby
1
star
40

wiki_md

Designed for maininting many wiki entries within a single document in Markdown format. #nothrills #personalwiki
Ruby
1
star
41

rss_creator

A gem for creating RSS feeds
Ruby
1
star
42

app-routes

App-routes makes is possible to add sinatra-like routes to your Ruby based web server
Ruby
1
star
43

testkit123

Generates a test suite of files (for use with the testdata gem) from a config file.
Ruby
1
star
44

mymedia-wiki

Transforms a kind of Markdown document using Kramdown and XSLT.
Ruby
1
star
45

chatgpt2023

1st experiment at playing with the ChatGPT API.
Ruby
1
star
46

activeoutline

A DRb server which accepts the name of a page or link to be fetched. Uses an XML lookup file (PolyrexLinks format).
Ruby
1
star
47

mymedia_snippets

A MyMedia gem for publishing code snippets
Ruby
1
star
48

humble_rpi-plugin-magneticswitch

A Humble RPi plugin which detects the opening or closing of a door using a magnetic switch sensor.
Ruby
1
star
49

drb_fileclient-readwrite

A DRb file reader and writer client to access the DRb_fileserver service.
Ruby
1
star
50

rbbrs24

Experiment with submitting Ruby code from the browser to be executed on the server. Recommended for private use only.
Ruby
1
star
51

qnd_html2page

Splits HTML into pages suitable for reading like a book.
Ruby
1
star
52

mindwords

Helps get what's in your mind into a structure using words and hashtags.
Ruby
1
star
53

kvx

Kvx (Keys, Values, and XML) make it convenient to transform a Hash into XML or vice versa as well as string parsing
Ruby
1
star
54

rxfreader

Reads a file from an HTTP address, DFS address, or local location.
Ruby
1
star
55

rpi_pinin_msgout

Returns meaningful messages for humans from the capture of a Raspberry PI GPIO input pin.
Ruby
1
star
56

humble_rpi

The Humble RPi gem uses a Raspberry Pi + LEDs + motion sensor + 16x2 LCD + SimplePubSub
Ruby
1
star
57

drb_fileserver_plus

Designed to provide fault tolerant access to a DRb file server when 2 or more back-end nodes are running.
Ruby
1
star
58

xdrp

A basic macro recorder for GNU/Linux which uses program xinput to capture input events.
Ruby
1
star
59

hcitools_wrapper

Uses hcitool lescan + hcidump --r to fetch the RSSI values from a Bluetooth device address.
Ruby
1
star
60

drb_fileserver

A DRb server to read or write local files.
Ruby
1
star
61

cerecvoice2019

Unofficial Cerevoice gem using their text-to-speech API. #tts
Ruby
1
star
62

railsbuilder

Build a Rails app from a configuration file.
Ruby
1
star
63

soundplayer

Cross-platform sound player (WAV, and Ogg Vorbis)
Ruby
1
star
64

rxfhelper

Read XML File helper determines from the parameter if it should read a file, URL or a plain string.
Ruby
1
star
65

rpi

Makes the LEDs (connected via the GPIO pins) on the Raspberry Pi blink!
Ruby
1
star
66

method_parser

Uses the Parser gem to primarily return the defined methods for the class
Ruby
1
star
67

hidg0

Used with a Raspberry PI Zero plugged into a computer to act as USB Keyboard (HID).
Ruby
1
star
68

mymedia_frontend

An admin frontend for a MyMedia project (under development).
Ruby
1
star
69

rxfileio

Features remote file operations using the DFS protocol and more.
Ruby
1
star
70

sra2019

Steps Recorder (MS Windows) Analyser 2019
Ruby
1
star
71

indydoc

Generate source code documentation from source code + Polyrex file
Ruby
1
star
72

yawc

Yet Another Word Counter (YAWC) makes it convenient to count the number of words in a string and return the result as a hash object.
Ruby
1
star
73

humble_rpi-plugin-pir

A humble_rpi plugin which detects motion for 1 or more PIR sensor
Ruby
1
star
74

martile-plugin-rbbrs24

A Martile plugin to generate an HTML form from the Rbbrs24 gem.
Ruby
1
star
75

ruby_qb101

Ruby related questions to ask Chat GPT. #experimental
Ruby
1
star
76

bibletools

Performs a word count within a specified book. Returns the verses within a specified book for a given keyword.
Ruby
1
star
77

coinmarketcap_lite

Queries the CoinMarketCap API using your API key. Returns the latest prices for the top 100 coins etc.
Ruby
1
star
78

mymedia-pages

A MyMedia gem to publish a basic web page
Ruby
1
star
79

dynarex-password

Generate a Dynarex password lookup file and use it to make strong passwords from weak passwords.
Ruby
1
star
80

liveblog

Uses the Dynarex gem to create a daily live blog. Convenient for grouping together microblog posts.
Ruby
1
star
81

mcp3008pi

Reads analog values from an MCP3008 10-bit Analog-to-Digital Converter (ADC) connected to a Raspberry Pi.
Ruby
1
star
82

quiz

Quiz makes it convenient to create a simple multiple-choice style quiz using an XML file to store questions, multiple-choices, and answers
Ruby
1
star
83

drb_fileclient-reader

A DRb file reader client to access the DRb_fileserver service.
Ruby
1
star
84

reverse-markdown

Convert HTML to Markdown
Ruby
1
star
85

universal_dom_remote

Interacts with the web browser via websockets using a SimplePubSub broker. Note: Tested using Firefox.
Ruby
1
star