Skip to content

Instantly share code, notes, and snippets.

@lyleunderwood
Created March 23, 2011 23:28
Show Gist options
  • Save lyleunderwood/884257 to your computer and use it in GitHub Desktop.
Save lyleunderwood/884257 to your computer and use it in GitHub Desktop.
module B
attr_accessor :b_config
def get_b_config
@config[:b]
end
def B.extend_object(target)
super
target.b_config = target.get_b_config
end
end
class A
def initialize
@config = {:a => 1, :b => 2}
self.extend B
end
end
A.new.b_config.should eq 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment