Sha256: 8f8950bef0dbc85836ea2bdbde4db8ad7eb77b38b9255f007a3a5d486c1bd1de
Contents?: true
Size: 860 Bytes
Versions: 1
Compression:
Stored size: 860 Bytes
Contents
module Chronic class TimeSpecial < Tag # Scan an Array of Token objects and apply any necessary TimeSpecial # tags to each token. # # tokens - An Array of tokens to scan. # options - The Hash of options specified in Chronic::parse. # # Returns an Array of tokens. def self.scan(tokens, options) tokens.each do |token| token.tag scan_for(token, self, patterns, options) end end def self.patterns @@patterns ||= { 'now' => :now, 'morning' => :morning, 'noon' => :noon, 'afternoon' => :afternoon, 'evening' => :evening, /^(to)?(night|nite)$/ => :night, 'midnight' => :midnight } end def to_s 'timespecial-' << @type.to_s end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chronic-davispuh-0.10.2.v0.1da32066b3f46f2506b3471e39557497e34afa27 | lib/chronic/tags/time_special.rb |