Class: Timezone::Parser

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

Defined Under Namespace

Classes: Line

Constant Summary collapse

LINE =
/\s*(.+)\s*=\s*(.+)\s*isdst=(\d+)\s*gmtoff=([\+\-]*\d+)/
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.



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

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

Instance Attribute Details

#zoneinfoObject (readonly)

Returns the value of attribute zoneinfo.



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

def zoneinfo
  @zoneinfo
end

Instance Method Details

#performObject



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

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