lib/tzinfo/timezone.rb in tzinfo-1.2.0 vs lib/tzinfo/timezone.rb in tzinfo-1.2.1

- old
+ new

@@ -197,11 +197,11 @@ Country.get('US').zone_identifiers end # The identifier of the timezone, e.g. "Europe/Paris". def identifier - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + raise_unknown_timezone end # An alias for identifier. def name # Don't use alias, as identifier gets overridden. @@ -266,19 +266,19 @@ # Returns the TimezonePeriod for the given UTC time. utc can either be # a DateTime, Time or integer timestamp (Time.to_i). Any timezone # information in utc is ignored (it is treated as a UTC time). def period_for_utc(utc) - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + raise_unknown_timezone end # Returns the set of TimezonePeriod instances that are valid for the given # local time as an array. If you just want a single period, use # period_for_local instead and specify how ambiguities should be resolved. # Returns an empty array if no periods are found for the given time. def periods_for_local(local) - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + raise_unknown_timezone end # Returns an Array of TimezoneTransition instances representing the times # where the UTC offset of the timezone changes. # @@ -300,11 +300,11 @@ # integer timestamps (Time.to_i). # # If utc_from is specified and utc_to is not greater than utc_from, then # transitions_up_to raises an ArgumentError exception. def transitions_up_to(utc_to, utc_from = nil) - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + raise_unknown_timezone end # Returns the canonical Timezone instance for this Timezone. # # The IANA Time Zone database contains two types of definition: Zones and @@ -339,11 +339,11 @@ # tzinfo-data gem should be installed. # # The TZInfo::DataSource.get method can be used to check which DataSource # implementation is being used. def canonical_zone - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' + raise_unknown_timezone end # Returns the TimezonePeriod for the given local time. local can either be # a DateTime, Time or integer timestamp (Time.to_i). Any timezone # information in local is ignored (it is treated as a time in the current @@ -625,8 +625,12 @@ end # Returns the current DataSource def self.data_source DataSource.get + end + + def raise_unknown_timezone + raise UnknownTimezone, 'TZInfo::Timezone constructed directly' end end end