Sha256: 6920c321fe907121b7b88f82c53021e2e56fedfad6b1e069171d666a09520fcf

Contents?: true

Size: 530 Bytes

Versions: 10

Compression:

Stored size: 530 Bytes

Contents

module Chronic
  class TimeZone < Tag #:nodoc:
    def self.scan(tokens)
      tokens.each_index do |i|
        if t = self.scan_for_all(tokens[i]) then tokens[i].tag(t); next end
      end
      tokens
    end

    def self.scan_for_all(token)
      scanner = {/[PMCE][DS]T/i => :tz,
                 /(tzminus)?\d{4}/ => :tz}
      scanner.keys.each do |scanner_item|
        return self.new(scanner[scanner_item]) if scanner_item =~ token.word
      end
      return nil
    end

    def to_s
      'timezone'
    end
  end
end

Version data entries

10 entries across 10 versions & 9 rubygems

Version Path
blakechambers-chronic-0.3.0.2 lib/chronic/time_zone.rb
jdl-chronic-0.3.0.1 lib/chronic/time_zone.rb
lmarlow-chronic-0.3.0.1 lib/chronic/time_zone.rb
mojombo-chronic-0.3.0 lib/chronic/time_zone.rb
moorage-chronic-0.3.0 lib/chronic/time_zone.rb
rgm-chronic-0.3.1 lib/chronic/time_zone.rb
sethwalker-chronic-0.3.0 lib/chronic/time_zone.rb
jdl-chronic-0.3.0.2 lib/chronic/time_zone.rb
caleb-chronic-0.3.0 lib/chronic/time_zone.rb
pyrat-chronic-0.3.1 lib/chronic/time_zone.rb