From 186fd4f631c7265988823ff7052b7bce6a1b9ee4 Mon Sep 17 00:00:00 2001 From: saki7 Date: Fri, 23 Jan 2015 01:52:44 +0900 Subject: [PATCH] Load RubyUnits::Unit instead of Date::Unit when overriding --- lib/ruby_units/date.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ruby_units/date.rb b/lib/ruby_units/date.rb index 70b75770..ca2f5944 100644 --- a/lib/ruby_units/date.rb +++ b/lib/ruby_units/date.rb @@ -8,7 +8,7 @@ class Date # @return [Unit] def +(unit) case unit - when Unit + when RubyUnits::Unit unit = unit.convert_to('d').round if ['y', 'decade', 'century'].include? unit.units unit_date_add(unit.convert_to('day').scalar) else @@ -21,7 +21,7 @@ def +(unit) # @return [Unit] def -(unit) case unit - when Unit + when RubyUnits::Unit unit = unit.convert_to('d').round if ['y', 'decade', 'century'].include? unit.units unit_date_sub(unit.convert_to('day').scalar) else @@ -34,7 +34,7 @@ def -(unit) # @return (see Unit#initialize) # @param [Object] other convert to same units as passed def to_unit(other = nil) - other ? Unit.new(self).convert_to(other) : Unit.new(self) + other ? RubyUnits::Unit.new(self).convert_to(other) : RubyUnits::Unit.new(self) end alias :unit :to_unit @@ -63,4 +63,4 @@ def to_date # :nocov_19: end -end \ No newline at end of file +end