Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix Rails 3.1 deprecation warnings

closes #32
  • Loading branch information...
commit 9f704031c0ee60b41d3afe4278495333e1a1515e 1 parent c04370b
@jduff jduff authored
View
4 lib/vendor/quantified/lib/quantified.rb
@@ -1,8 +1,6 @@
$: << File.dirname(__FILE__)
-
-require 'active_support/all'
require 'bigdecimal'
require 'quantified/attribute'
require 'quantified/mass'
-require 'quantified/length'
+require 'quantified/length'
View
28 lib/vendor/quantified/lib/quantified/attribute.rb
@@ -76,14 +76,10 @@ def self.units(system=nil)
if system
self.systems_to_units[system.to_sym].dup
else
- read_inheritable_attribute(:primitives) | self.conversions.keys
+ self.primitives | self.conversions.keys
end
end
- def self.primitives
- read_inheritable_attribute(:primitives).dup
- end
-
def self.non_primitives
self.conversions.keys
end
@@ -103,14 +99,18 @@ def self.numeric_methods(*args)
end
protected
-
- class_inheritable_accessor :add_numeric_methods, :primitives, :conversions, :current_system, :systems_to_units, :units_to_systems
- self.add_numeric_methods = false
- self.primitives = []
- self.conversions = {}
- self.current_system = nil
- self.systems_to_units = {}
- self.units_to_systems = {}
+
+ class << self
+ def primitives; @primitives ||= []; end
+ def add_numeric_methods; @add_numeric_methods ||= false; end
+ def add_numeric_methods=(v); @add_numeric_methods = v; end
+ def conversions; @conversions ||= {}; end
+ def current_system; @current_system; end
+ def current_system=(v); @current_system = v; end
+ def systems_to_units; @systems_to_units ||= {}; end
+ def units_to_systems; @units_to_systems ||= {}; end
+ end
+
def self.system(system_name, &block)
old_system = self.current_system
@@ -205,4 +205,4 @@ def self.add_numeric_method_for(unit_name, options={})
end
end
end
-end
+end
View
10 lib/vendor/quantified/test/test_helper.rb
@@ -1,2 +1,10 @@
require 'test/unit'
-require File.dirname(__FILE__) + '/../lib/quantified'
+begin
+ require 'active_support/inflector'
+rescue LoadError => e
+ require 'rubygems'
+ gem "activesupport", ">= 2.3.5"
+ require 'active_support/inflector'
+end
+
+require File.dirname(__FILE__) + '/../lib/quantified'
Please sign in to comment.
Something went wrong with that request. Please try again.