Class: Timezone::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/timezone/parser.rb

Constant Summary collapse

LINE =
/\s*(.+)\s*=\s*(.+)\s*isdst=(\d+)\s*gmtoff=([\+\-]*\d+)/
FORMAT =
'%a %b %e %H:%M:%S %Y %Z'
ZONEINFO_DIR =
'/usr/share/zoneinfo'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(zoneinfo = ZONEINFO_DIR) ⇒ Parser

Returns a new instance of Parser.



12
13
14
# File 'lib/timezone/parser.rb', line 12

def initialize(zoneinfo = ZONEINFO_DIR)
  @zoneinfo = zoneinfo
end

Instance Attribute Details

#zoneinfoObject (readonly)

Returns the value of attribute zoneinfo.



10
11
12
# File 'lib/timezone/parser.rb', line 10

def zoneinfo
  @zoneinfo
end

Instance Method Details

#performObject



16
17
18
19
20
21
# File 'lib/timezone/parser.rb', line 16

def perform
  Dir["#{zoneinfo}/right/**/*"].each do |file|
    next if File.directory?(file)
    parse(file)
  end
end