Class: Timezone::Parser::Line
- Inherits:
-
Object
- Object
- Timezone::Parser::Line
- Defined in:
- lib/timezone/parser.rb
Constant Summary collapse
- SOURCE_FORMAT =
'%a %b %e %H:%M:%S %Y %Z'
Instance Attribute Summary collapse
-
#dst ⇒ Object
Returns the value of attribute dst.
-
#name ⇒ Object
Returns the value of attribute name.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(match) ⇒ Line
constructor
A new instance of Line.
- #to_s ⇒ Object
Constructor Details
#initialize(match) ⇒ Line
Returns a new instance of Line.
29 30 31 32 33 34 |
# File 'lib/timezone/parser.rb', line 29 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 ⇒ Object
Returns the value of attribute dst.
25 26 27 |
# File 'lib/timezone/parser.rb', line 25 def dst @dst end |
#name ⇒ Object
Returns the value of attribute name.
25 26 27 |
# File 'lib/timezone/parser.rb', line 25 def name @name end |
#offset ⇒ Object
Returns the value of attribute offset.
25 26 27 |
# File 'lib/timezone/parser.rb', line 25 def offset @offset end |
#source ⇒ Object
Returns the value of attribute source.
25 26 27 |
# File 'lib/timezone/parser.rb', line 25 def source @source end |
Instance Method Details
#==(other) ⇒ Object
36 37 38 |
# File 'lib/timezone/parser.rb', line 36 def ==(other) name == other.name && dst == other.dst && offset == other.offset end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/timezone/parser.rb', line 40 def to_s [source, name, dst, offset].join(':') end |