Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

Commit

Permalink
Fix Rails 3.1 deprecation warnings
Browse files Browse the repository at this point in the history
closes #32
  • Loading branch information
John Duff committed Sep 27, 2011
1 parent c04370b commit 9f70403
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
4 changes: 1 addition & 3 deletions lib/vendor/quantified/lib/quantified.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,6 @@
$: << File.dirname(__FILE__) $: << File.dirname(__FILE__)

require 'active_support/all'
require 'bigdecimal' require 'bigdecimal'


require 'quantified/attribute' require 'quantified/attribute'
require 'quantified/mass' require 'quantified/mass'
require 'quantified/length' require 'quantified/length'
28 changes: 14 additions & 14 deletions lib/vendor/quantified/lib/quantified/attribute.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -76,14 +76,10 @@ def self.units(system=nil)
if system if system
self.systems_to_units[system.to_sym].dup self.systems_to_units[system.to_sym].dup
else else
read_inheritable_attribute(:primitives) | self.conversions.keys self.primitives | self.conversions.keys
end end
end end


def self.primitives
read_inheritable_attribute(:primitives).dup
end

def self.non_primitives def self.non_primitives
self.conversions.keys self.conversions.keys
end end
Expand All @@ -103,14 +99,18 @@ def self.numeric_methods(*args)
end end


protected protected


class_inheritable_accessor :add_numeric_methods, :primitives, :conversions, :current_system, :systems_to_units, :units_to_systems class << self
self.add_numeric_methods = false def primitives; @primitives ||= []; end
self.primitives = [] def add_numeric_methods; @add_numeric_methods ||= false; end
self.conversions = {} def add_numeric_methods=(v); @add_numeric_methods = v; end
self.current_system = nil def conversions; @conversions ||= {}; end
self.systems_to_units = {} def current_system; @current_system; end
self.units_to_systems = {} 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) def self.system(system_name, &block)
old_system = self.current_system old_system = self.current_system
Expand Down Expand Up @@ -205,4 +205,4 @@ def self.add_numeric_method_for(unit_name, options={})
end end
end end
end end
end end
10 changes: 9 additions & 1 deletion lib/vendor/quantified/test/test_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,2 +1,10 @@
require 'test/unit' 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'

0 comments on commit 9f70403

Please sign in to comment.