ruby-units 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/CHANGELOG +3 -1
  2. data/lib/ruby-units.rb +9 -1
  3. metadata +2 -2
data/CHANGELOG CHANGED
@@ -117,4 +117,6 @@ Change Log for Ruby-units
117
117
  Unit(1,"mm")
118
118
  Unit(1,"mm/s")
119
119
  Unit(1,"mm","s")
120
- 2006-10-02 0.3.1 * minor bug fixes
120
+ 2006-10-02 0.3.1 * minor bug fixes
121
+
122
+ 2006-10-03 0.3.2 * bug fix for compatibility with Rails
data/lib/ruby-units.rb CHANGED
@@ -1069,10 +1069,18 @@ class String
1069
1069
  unit_format(*args)
1070
1070
  end
1071
1071
  end
1072
-
1072
+
1073
+ #needed for compatibility with Rails, which defines a String.from method
1074
+ if self.public_instance_methods.include? 'from'
1075
+ puts 'rails'
1076
+ alias :old_from :from
1077
+ end
1078
+
1073
1079
  def from(time_point = ::Time.now)
1080
+ return old_from(time_point) if Integer === time_point
1074
1081
  self.unit.from(time_point)
1075
1082
  end
1083
+
1076
1084
  alias :after :from
1077
1085
  alias :from_now :from
1078
1086
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ruby-units
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.3.1
7
- date: 2006-10-02 00:00:00 -04:00
6
+ version: 0.3.2
7
+ date: 2006-10-03 00:00:00 -04:00
8
8
  summary: A model that performs unit conversions and unit math
9
9
  require_paths:
10
10
  - lib