### Home Classes Methods

### In Files

- lib/chronic/separator.rb

### Parent

Tag

### Methods

- ::scan
- ::scan_for_and
- ::scan_for_at
- ::scan_for_colon
- ::scan_for_commas
- ::scan_for_dash
- ::scan_for_dots
- ::scan_for_in
- ::scan_for_on
- ::scan_for_quote
- ::scan_for_slash
- ::scan_for_space
- ::scan_for_t
- ::scan_for_w
- #to_s

### Files

- LICENSE

### Class/Module Index

Quicksearch

- Chronic
- Chronic::Date
- Chronic::Grabber
- Chronic::Handler
- Chronic::Handlers
- Chronic::MiniDate
- Chronic::Numerizer
- Chronic::Ordinal
- Chronic::Parser
- Chronic::Pointer
- Chronic::Repeater
- Chronic::Scalar
- Chronic::Season
- Chronic::Separator
- Chronic::Sign
- Chronic::Span
- Chronic::Tag
- Chronic::Time
- Chronic::TimeZone
- Chronic::Token

No matching classes.

# Chronic::Separator

### Public Class Methods

scan(tokens, options) click to toggle source

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.

    # 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_for_and(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeperatorAnd Object object.

    # File lib/chronic/separator.rb, line 106
    def self.scan_for_and(token)
      scan_for token, SeparatorAnd, { /^and$/ => :and }
    end

scan_for_at(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorAt object.

    # File lib/chronic/separator.rb, line 85
    def self.scan_for_at(token)
      scan_for token, SeparatorAt, { /^(at|@)$/ => :at }
    end

scan_for_colon(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorColon object.

    # File lib/chronic/separator.rb, line 46
    def self.scan_for_colon(token)
      scan_for token, SeparatorColon, { /^:$/ => :colon }
    end

scan_for_commas(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorComma object.

    # File lib/chronic/separator.rb, line 32
    def self.scan_for_commas(token)
      scan_for token, SeparatorComma, { /^,$/ => :comma }
    end

scan_for_dash(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorDash object.

    # File lib/chronic/separator.rb, line 67
    def self.scan_for_dash(token)
      scan_for token, SeparatorDash, { /^-$/ => :dash }
    end

scan_for_dots(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorDot object.

    # File lib/chronic/separator.rb, line 39
    def self.scan_for_dots(token)
      scan_for token, SeparatorDot, { /^\.$/ => :dot }
    end

scan_for_in(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorIn object.

    # File lib/chronic/separator.rb, line 92
    def self.scan_for_in(token)
      scan_for token, SeparatorIn, { /^in$/ => :in }
    end

scan_for_on(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorOn object.

    # File lib/chronic/separator.rb, line 99
    def self.scan_for_on(token)
      scan_for token, SeparatorOn, { /^on$/ => :on }
    end

scan_for_quote(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorQuote object.

    # File lib/chronic/separator.rb, line 74
    def self.scan_for_quote(token)
      scan_for token, SeparatorQuote,
      {
        /^'$/ => :single_quote,
        /^"$/ => :double_quote
      }
    end

scan_for_slash(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorSlash object.

    # File lib/chronic/separator.rb, line 60
    def self.scan_for_slash(token)
      scan_for token, SeparatorSlash, { /^\/$/ => :slash }
    end

scan_for_space(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeparatorSpace object.

    # File lib/chronic/separator.rb, line 53
    def self.scan_for_space(token)
      scan_for token, SeparatorSpace, { /^ $/ => :space }
    end

scan_for_t(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeperatorT Object object.

    # File lib/chronic/separator.rb, line 113
    def self.scan_for_t(token)
      scan_for token, SeparatorT, { /^t$/ => :T }
    end

scan_for_w(token) click to toggle source

token - The Token object we want to scan.

Returns a new SeperatorW Object object.

    # File lib/chronic/separator.rb, line 120
    def self.scan_for_w(token)
      scan_for token, SeparatorW, { /^w$/ => :W }
    end

### Public Instance Methods

to_s() click to toggle source

    # File lib/chronic/separator.rb, line 124
    def to_s
      'separator'
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.