Skip to content

Commit

Permalink
maybe try active support first?
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Fisher committed Jul 28, 2010
1 parent 33e4c0a commit f465cc9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/support/cattr_accessor.rb
@@ -1,5 +1,9 @@
# Extends the class object with class and instance accessors for class attributes,
# just like the native attr* accessors for instance attributes.
unless Class.respond_to?(:cattr_accessor)
begin
require 'active_support/core_ext/class/attribute_accessors'
rescue LoadError
class Class # :nodoc:
def cattr_reader(*syms)
syms.each do |sym|
Expand Down Expand Up @@ -54,4 +58,6 @@ def cattr_accessor(*syms)
cattr_reader(*syms)
cattr_writer(*syms)
end unless instance_methods.include?('cattr_accessor')
end
end
end
end

0 comments on commit f465cc9

Please sign in to comment.