Index: lib/tzinfo/country_timezone.rb =================================================================== --- lib/tzinfo/country_timezone.rb (revision 386) +++ lib/tzinfo/country_timezone.rb (revision 387) @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2006-2010 Philip Ross +# Copyright (c) 2006-2012 Philip Ross # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -74,10 +74,9 @@ # current CountryTimezone (has the same identifer, latitude, longitude # and description). def ==(ct) - ct.respond_to?(:identifier) && ct.respond_to?(:latitude) && - ct.respond_to?(:longitude) && ct.respond_to?(:description) && - identifier == ct.identifier && latitude == ct.latitude && - longitude == ct.longitude && description == ct.description + ct.kind_of?(CountryTimezone) && + identifier == ct.identifier && latitude == ct.latitude && + longitude == ct.longitude && description == ct.description end # Returns true if and only if the given CountryTimezone is equal to the Index: lib/tzinfo/timezone_transition_info.rb =================================================================== --- lib/tzinfo/timezone_transition_info.rb (revision 386) +++ lib/tzinfo/timezone_transition_info.rb (revision 387) @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2006-2010 Philip Ross +# Copyright (c) 2006-2012 Philip Ross # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -98,7 +98,7 @@ # considered to be equal by == if offset, previous_offset and at are all # equal. def ==(tti) - tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && tti.respond_to?(:at) && + tti.kind_of?(TimezoneTransitionInfo) && offset == tti.offset && previous_offset == tti.previous_offset && at == tti.at end @@ -109,8 +109,7 @@ # which just requires the at times to be equal regardless of how they were # originally specified. def eql?(tti) - tti.respond_to?(:offset) && tti.respond_to?(:previous_offset) && - tti.respond_to?(:numerator_or_time) && tti.respond_to?(:denominator) && + tti.kind_of?(TimezoneTransitionInfo) && offset == tti.offset && previous_offset == tti.previous_offset && numerator_or_time == tti.numerator_or_time && denominator == tti.denominator end Index: lib/tzinfo/timezone_period.rb =================================================================== --- lib/tzinfo/timezone_period.rb (revision 386) +++ lib/tzinfo/timezone_period.rb (revision 387) @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2005-2010 Philip Ross +# Copyright (c) 2005-2012 Philip Ross # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -165,17 +165,19 @@ # Returns true if this TimezonePeriod is equal to p. This compares the # start_transition, end_transition and offset using ==. def ==(p) - p.respond_to?(:start_transition) && p.respond_to?(:end_transition) && - p.respond_to?(:offset) && start_transition == p.start_transition && - end_transition == p.end_transition && offset == p.offset + p.kind_of?(TimezonePeriod) && + start_transition == p.start_transition && + end_transition == p.end_transition && + offset == p.offset end # Returns true if this TimezonePeriods is equal to p. This compares the # start_transition, end_transition and offset using eql? def eql?(p) - p.respond_to?(:start_transition) && p.respond_to?(:end_transition) && - p.respond_to?(:offset) && start_transition.eql?(p.start_transition) && - end_transition.eql?(p.end_transition) && offset.eql?(p.offset) + p.kind_of?(TimezonePeriod) && + start_transition.eql?(p.start_transition) && + end_transition.eql?(p.end_transition) && + offset.eql?(p.offset) end # Returns a hash of this TimezonePeriod. Index: lib/tzinfo/time_or_datetime.rb =================================================================== --- lib/tzinfo/time_or_datetime.rb (revision 386) +++ lib/tzinfo/time_or_datetime.rb (revision 387) @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2006-2010 Philip Ross +# Copyright (c) 2006-2012 Philip Ross # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -251,7 +251,7 @@ # constructed with the same type (DateTime, Time or timestamp) as this # TimeOrDateTime. def eql?(todt) - todt.respond_to?(:to_orig) && to_orig.eql?(todt.to_orig) + todt.kind_of?(TimeOrDateTime) && to_orig.eql?(todt.to_orig) end # Returns a hash of this TimeOrDateTime. Index: lib/tzinfo/timezone_offset_info.rb =================================================================== --- lib/tzinfo/timezone_offset_info.rb (revision 386) +++ lib/tzinfo/timezone_offset_info.rb (revision 387) @@ -1,5 +1,5 @@ #-- -# Copyright (c) 2006 Philip Ross +# Copyright (c) 2006-2012 Philip Ross # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -71,7 +71,7 @@ # Returns true if and only if toi has the same utc_offset, std_offset # and abbreviation as this TimezoneOffsetInfo. def ==(toi) - toi.respond_to?(:utc_offset) && toi.respond_to?(:std_offset) && toi.respond_to?(:abbreviation) && + toi.kind_of?(TimezoneOffsetInfo) && utc_offset == toi.utc_offset && std_offset == toi.std_offset && abbreviation == toi.abbreviation end