Last active
October 28, 2015 22:56
-
-
Save mrgenixus/9a1d73f2e55c56452df9 to your computer and use it in GitHub Desktop.
quasi-inherited hashes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A sample Gemfile | |
source "https://rubygems.org" | |
gem "pry" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler/setup' | |
Bundler.require(:default) | |
class MyClass | |
def self.params args = {} | |
@params = (@params or {}).merge args | |
super_params = {} | |
if superclass.respond_to?(:params) | |
super_params = superclass.params | |
end | |
super_params.merge @params | |
end | |
def params | |
self.class.params | |
end | |
end | |
class MyNewClass < MyClass; end | |
binding.pry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment