123456789_123456789_123456789_123456789_123456789_

Class: Timezone::Parser::Line

Relationships & Source Files
Inherits: Object
Defined in: lib/timezone/parser.rb

Overview

Represents a single timezone data file line.

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(match) ⇒ Line

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 82

def initialize(match)
  self.source = Time.strptime("#{match[1]}C", SOURCE_FORMAT).to_i
  self.name = match[2].split(' ').last
  self.dst = match[3].to_i
  self.offset = match[4].to_i
end

Instance Attribute Details

#dst (rw)

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 78

attr_accessor :source, :name, :dst, :offset

#name (rw)

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 78

attr_accessor :source, :name, :dst, :offset

#offset (rw)

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 78

attr_accessor :source, :name, :dst, :offset

#source (rw)

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 78

attr_accessor :source, :name, :dst, :offset

Instance Method Details

#==(other)

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 89

def ==(other)
  name == other.name && dst == other.dst && offset == other.offset
end

#to_s

[ GitHub ]

  
# File 'lib/timezone/parser.rb', line 93

def to_s
  [source, name, dst, offset].join(':')
end