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.
862 863 864 865 866 867 868 |
# File 'lib/tzinfo/tzdataparser.rb', line 862 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.
856 857 858 |
# File 'lib/tzinfo/tzdataparser.rb', line 856 def at_utc @at_utc end |
#offset_name ⇒ Object
Returns the value of attribute offset_name.
860 861 862 |
# File 'lib/tzinfo/tzdataparser.rb', line 860 def offset_name @offset_name end |
#std_offset ⇒ Object (readonly)
Returns the value of attribute std_offset.
858 859 860 |
# File 'lib/tzinfo/tzdataparser.rb', line 858 def std_offset @std_offset end |
#utc_offset ⇒ Object (readonly)
Returns the value of attribute utc_offset.
857 858 859 |
# File 'lib/tzinfo/tzdataparser.rb', line 857 def utc_offset @utc_offset end |
#zone_id ⇒ Object (readonly)
Returns the value of attribute zone_id.
859 860 861 |
# File 'lib/tzinfo/tzdataparser.rb', line 859 def zone_id @zone_id end |
Instance Method Details
#<=>(transition) ⇒ Object
874 875 876 877 878 879 880 881 882 883 884 |
# File 'lib/tzinfo/tzdataparser.rb', line 874 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
890 891 892 |
# File 'lib/tzinfo/tzdataparser.rb', line 890 def clone_with_at(at_utc) TZDataTransition.new(at_utc, @utc_offset, @std_offset, @zone_id) end |
#to_s ⇒ Object
870 871 872 |
# File 'lib/tzinfo/tzdataparser.rb', line 870 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
886 887 888 |
# File 'lib/tzinfo/tzdataparser.rb', line 886 def total_offset @utc_offset + @std_offset end |
#write(file) ⇒ Object
894 895 896 897 898 |
# File 'lib/tzinfo/tzdataparser.rb', line 894 def write(file) if @at_utc file.puts "tz.transition #{@at_utc.year}, #{@at_utc.mon}, :#{@offset_name}, #{datetime_constructor(@at_utc)}" end end |