Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

No need for ClassLevelInheritableAttributes

  • Loading branch information...
commit d677c22b2277aaff468b5d1915fdfe5180484ba6 1 parent 50a1b8a
Elliot Winkler authored
1  lib/address_standardization.rb
View
@@ -11,7 +11,6 @@
here = File.expand_path('..', __FILE__)
require "#{here}/address_standardization/ruby_ext"
-require "#{here}/address_standardization/class_level_inheritable_attributes"
require "#{here}/address_standardization/helpers"
require "#{here}/address_standardization/address"
8 lib/address_standardization/abstract_service.rb
View
@@ -1,10 +1,8 @@
module AddressStandardization
class AbstractService
- extend ClassLevelInheritableAttributes
- cattr_inheritable :canned_response
- self.canned_response = :success
-
class << self
+ attr_accessor :canned_response
+
def standardize_address(address_info)
if AddressStandardization.test_mode?
get_canned_response(address_info)
@@ -35,5 +33,7 @@ def logger
AddressStandardization.logger
end
end
+
+ self.canned_response = :success
end
end
20 lib/address_standardization/class_level_inheritable_attributes.rb
View
@@ -1,20 +0,0 @@
-# from <http://railstips.org/2008/6/13/a-class-instance-variable-update>
-module ClassLevelInheritableAttributes
- def cattr_inheritable(*args)
- @cattr_inheritable_attrs ||= [:cattr_inheritable_attrs]
- @cattr_inheritable_attrs += args
- args.each do |arg|
- class_eval %(
- class << self; attr_accessor :#{arg} end
- )
- end
- @cattr_inheritable_attrs
- end
-
- def inherited(subclass)
- @cattr_inheritable_attrs.each do |inheritable_attribute|
- instance_var = "@#{inheritable_attribute}"
- subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
- end
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.