Module: HTTParty::ModuleInheritableAttributes::ClassMethods
- Defined in:
- lib/httparty/module_inheritable_attributes.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#inherited(subclass) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/httparty/module_inheritable_attributes.rb', line 17 def inherited(subclass) @mattr_inheritable_attrs.each do |inheritable_attribute| instance_var = "@#{inheritable_attribute}" subclass.instance_variable_set(instance_var, instance_variable_get(instance_var).clone) end end |
#mattr_inheritable(*args) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/httparty/module_inheritable_attributes.rb', line 8 def mattr_inheritable(*args) @mattr_inheritable_attrs ||= [:mattr_inheritable_attrs] @mattr_inheritable_attrs += args args.each do |arg| module_eval %(class << self; attr_accessor :#{arg} end) end @mattr_inheritable_attrs end |