Class: TZInfo::TZDataTransition
- Inherits:
-
Object
- Object
- TZInfo::TZDataTransition
- Includes:
- Comparable
- Defined in:
- lib/tzinfo/tzdataparser.rb
Overview
A transition that will be used to write the periods in a zone class.
Instance Attribute Summary collapse
-
#at_utc ⇒ Object
readonly
Returns the value of attribute at_utc.
-
#offset_name ⇒ Object
Returns the value of attribute offset_name.
-
#std_offset ⇒ Object
readonly
Returns the value of attribute std_offset.
-
#utc_offset ⇒ Object
readonly
Returns the value of attribute utc_offset.
-
#zone_id ⇒ Object
readonly
Returns the value of attribute zone_id.
Instance Method Summary collapse
- #<=>(transition) ⇒ Object
- #clone_with_at(at_utc) ⇒ Object
-
#initialize(at_utc, utc_offset, std_offset, zone_id) ⇒ TZDataTransition
constructor
A new instance of TZDataTransition.
- #to_s ⇒ Object
- #total_offset ⇒ Object
- #write(file) ⇒ Object
Constructor Details
#initialize(at_utc, utc_offset, std_offset, zone_id) ⇒ TZDataTransition
Returns a new instance of TZDataTransition.
869 870 871 872 873 874 875 |
# File 'lib/tzinfo/tzdataparser.rb', line 869 def initialize(at_utc, utc_offset, std_offset, zone_id) @at_utc = at_utc @utc_offset = utc_offset @std_offset = std_offset @zone_id = zone_id @offset_name = nil end |
Instance Attribute Details
#at_utc ⇒ Object (readonly)
Returns the value of attribute at_utc.
863 864 865 |
# File 'lib/tzinfo/tzdataparser.rb', line 863 def at_utc @at_utc end |
#offset_name ⇒ Object
Returns the value of attribute offset_name.
867 868 869 |
# File 'lib/tzinfo/tzdataparser.rb', line 867 def offset_name @offset_name end |
#std_offset ⇒ Object (readonly)
Returns the value of attribute std_offset.
865 866 867 |
# File 'lib/tzinfo/tzdataparser.rb', line 865 def std_offset @std_offset end |
#utc_offset ⇒ Object (readonly)
Returns the value of attribute utc_offset.
864 865 866 |
# File 'lib/tzinfo/tzdataparser.rb', line 864 def utc_offset @utc_offset end |
#zone_id ⇒ Object (readonly)
Returns the value of attribute zone_id.
866 867 868 |
# File 'lib/tzinfo/tzdataparser.rb', line 866 def zone_id @zone_id end |
Instance Method Details
#<=>(transition) ⇒ Object
881 882 883 884 885 886 887 888 889 890 891 |
# File 'lib/tzinfo/tzdataparser.rb', line 881 def <=>(transition) if @at_utc == transition.at_utc 0 elsif @at_utc.nil? -1 elsif transition.nil? 1 else @at_utc - transition.at_utc end end |
#clone_with_at(at_utc) ⇒ Object
897 898 899 |
# File 'lib/tzinfo/tzdataparser.rb', line 897 def clone_with_at(at_utc) TZDataTransition.new(at_utc, @utc_offset, @std_offset, @zone_id) end |
#to_s ⇒ Object
877 878 879 |
# File 'lib/tzinfo/tzdataparser.rb', line 877 def to_s "At #{at_utc} UTC switch to UTC offset #{@utc_offset} with std offset #{@std_offset}, zone id #{@zone_id}" end |
#total_offset ⇒ Object
893 894 895 |
# File 'lib/tzinfo/tzdataparser.rb', line 893 def total_offset @utc_offset + @std_offset end |
#write(file) ⇒ Object
901 902 903 904 905 |
# File 'lib/tzinfo/tzdataparser.rb', line 901 def write(file) if @at_utc file.puts "tz.transition #{@at_utc.year}, #{@at_utc.mon}, :#{@offset_name}, #{datetime_constructor(@at_utc)}" end end |