Class: Chronic::TimeZone

Inherits:
Tag
  • Object
show all
Defined in:
lib/chronic/time_zone.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Tag

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tag

#initialize, #start=

Constructor Details

This class inherits a constructor from Chronic::Tag

Class Method Details

.scan(tokens, options) ⇒ Object



3
4
5
6
7
# File 'lib/chronic/time_zone.rb', line 3

def self.scan(tokens, options)
  tokens.each_index do |i|
    if t = scan_for_all(tokens[i]) then tokens[i].tag(t); next end
  end
end

.scan_for_all(token) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/chronic/time_zone.rb', line 9

def self.scan_for_all(token)
  scan_for token, self,
  {
    /[PMCE][DS]T/i => :tz,
    /(tzminus)?\d{4}/ => :tz
  }
end

Instance Method Details

#to_sObject



17
18
19
# File 'lib/chronic/time_zone.rb', line 17

def to_s
  'timezone'
end