module Deprecatable::ClassMethods
Public Instance Methods
accessors()
click to toggle source
# File lib/acread/deprecatable.rb, line 23 def accessors # TODO: replace this constant by an ActiveRecord inspection ACCESSORS end
deprecate_attribute(attr, opts={})
click to toggle source
# File lib/acread/deprecatable.rb, line 12 def deprecate_attribute(attr, opts={}) opts ||={} @deprecated_attributes ||=[] @deprecated_attributes << attr.to_s overide_accessors attr, opts end
deprecated_attributes()
click to toggle source
# File lib/acread/deprecatable.rb, line 19 def deprecated_attributes @deprecated_attributes end
overide_accessors(attr, opts)
click to toggle source
Calls superclass method
# File lib/acread/deprecatable.rb, line 28 def overide_accessors(attr, opts) msg = "You can't access atribute #{attr}, it has been deprecated" accessors.each do |term| define_method("#{attr}#{term}") do |*args| raise DeprecatedAttributeError, msg (args.length >0 ? super(args) : super()).first # call ActiveRecord behavior if previous exception have been continued end end end