Class: Chronic::TimeZone
- Inherits:
-
Tag
- Object
- Tag
- Chronic::TimeZone
show all
- Defined in:
- lib/chronic/time_zone.rb
Overview
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) ⇒ Object
3
4
5
6
7
8
|
# File 'lib/chronic/time_zone.rb', line 3
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
|
.scan_for_all(token) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/chronic/time_zone.rb', line 10
def self.scan_for_all(token)
if RUBY_VERSION =~ /1\.9\./
scanner = {/[PMCE][DS]T/i => :tz}
else
scanner = {/[PMCE][DS]T/i => :tz, /(tzminus)?[01]\d[304][05]/ => :tz}
end
scanner.keys.each do |scanner_item|
return self.new(scanner[scanner_item]) if scanner_item =~ token.word
end
return nil
end
|
Instance Method Details
#to_s ⇒ Object
22
23
24
|
# File 'lib/chronic/time_zone.rb', line 22
def to_s
'timezone'
end
|