wondering if my Ruby-fu can create an alternative to ActiveSupport's deprecated class_inheritable_ary
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
Gemfile.lock
MIT-LICENSE
README.txt
Rakefile
class_inheritable.gemspec

README.txt

Attempt to duplicate the functionality of Rails' old class_inheritable_ary
without monkey-patching base-classes or polluting target classes with
unexpected methods/attributes

Basic use-case:
  gem install class_inheritable
  irb
    require 'class_inheritable'
    class MyClass
       ClassInheritable::Array.attach :to => self, :as => :foo
       append_foo :bar
    end
    class MySubClass < MyClass
      append_foo :baz
    end

    [:bar] == MyClass.foo
    [:bar] == MyClass.new.foo

    [:bar, :baz] == MySubClass.foo
    [:bar, :baz] == MySubClass.new.foo

(See specs for more detailed use-cases.)
rspec ./spec/lib/class_inheritable/array_spec.rb