class Chronic::Separator
Public Class Methods
Source
# File lib/chronic/separator.rb, line 11 def self.scan(tokens, options) tokens.each do |token| if t = scan_for_commas(token) then token.tag(t); next end if t = scan_for_dots(token) then token.tag(t); next end if t = scan_for_colon(token) then token.tag(t); next end if t = scan_for_space(token) then token.tag(t); next end if t = scan_for_slash(token) then token.tag(t); next end if t = scan_for_dash(token) then token.tag(t); next end if t = scan_for_quote(token) then token.tag(t); next end if t = scan_for_at(token) then token.tag(t); next end if t = scan_for_in(token) then token.tag(t); next end if t = scan_for_on(token) then token.tag(t); next end if t = scan_for_and(token) then token.tag(t); next end if t = scan_for_t(token) then token.tag(t); next end if t = scan_for_w(token) then token.tag(t); next end end end
Scan an Array of Token
objects and apply any necessary Separator
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.
Source
# File lib/chronic/separator.rb, line 106 def self.scan_for_and(token) scan_for token, SeparatorAnd, { /^and$/ => :and } end
token - The Token
object we want to scan.
Returns a new SeperatorAnd Object object.
Source
# File lib/chronic/separator.rb, line 85 def self.scan_for_at(token) scan_for token, SeparatorAt, { /^(at|@)$/ => :at } end
token - The Token
object we want to scan.
Returns a new SeparatorAt
object.
Source
# File lib/chronic/separator.rb, line 46 def self.scan_for_colon(token) scan_for token, SeparatorColon, { /^:$/ => :colon } end
token - The Token
object we want to scan.
Returns a new SeparatorColon
object.
Source
# File lib/chronic/separator.rb, line 32 def self.scan_for_commas(token) scan_for token, SeparatorComma, { /^,$/ => :comma } end
token - The Token
object we want to scan.
Returns a new SeparatorComma
object.
Source
# File lib/chronic/separator.rb, line 67 def self.scan_for_dash(token) scan_for token, SeparatorDash, { /^-$/ => :dash } end
token - The Token
object we want to scan.
Returns a new SeparatorDash
object.
Source
# File lib/chronic/separator.rb, line 39 def self.scan_for_dots(token) scan_for token, SeparatorDot, { /^\.$/ => :dot } end
token - The Token
object we want to scan.
Returns a new SeparatorDot
object.
Source
# File lib/chronic/separator.rb, line 92 def self.scan_for_in(token) scan_for token, SeparatorIn, { /^in$/ => :in } end
token - The Token
object we want to scan.
Returns a new SeparatorIn
object.
Source
# File lib/chronic/separator.rb, line 99 def self.scan_for_on(token) scan_for token, SeparatorOn, { /^on$/ => :on } end
token - The Token
object we want to scan.
Returns a new SeparatorOn
object.
Source
# File lib/chronic/separator.rb, line 74 def self.scan_for_quote(token) scan_for token, SeparatorQuote, { /^'$/ => :single_quote, /^"$/ => :double_quote } end
token - The Token
object we want to scan.
Returns a new SeparatorQuote
object.
Source
# File lib/chronic/separator.rb, line 60 def self.scan_for_slash(token) scan_for token, SeparatorSlash, { /^\/$/ => :slash } end
token - The Token
object we want to scan.
Returns a new SeparatorSlash
object.
Source
# File lib/chronic/separator.rb, line 53 def self.scan_for_space(token) scan_for token, SeparatorSpace, { /^ $/ => :space } end
token - The Token
object we want to scan.
Returns a new SeparatorSpace
object.
Source
# File lib/chronic/separator.rb, line 113 def self.scan_for_t(token) scan_for token, SeparatorT, { /^t$/ => :T } end
token - The Token
object we want to scan.
Returns a new SeperatorT Object object.
Source
# File lib/chronic/separator.rb, line 120 def self.scan_for_w(token) scan_for token, SeparatorW, { /^w$/ => :W } end
token - The Token
object we want to scan.
Returns a new SeperatorW Object object.