Sha256: ca86d234662a623d4a14dfe39d1fc37dc9642b1bad1e16e1ec9e234763b80382
Contents?: true
Size: 632 Bytes
Versions: 2
Compression:
Stored size: 632 Bytes
Contents
module RequestLogAnalyzer module ClassLevelInheritableAttributes def inheritable_attributes(*args) @inheritable_attributes ||= [:inheritable_attributes] @inheritable_attributes += args args.each do |arg| class_eval %( class << self; attr_accessor :#{arg} end ) end @inheritable_attributes end def inherited(subclass) @inheritable_attributes.each do |inheritable_attribute| instance_var = "@#{inheritable_attribute}" subclass.instance_variable_set(instance_var, instance_variable_get(instance_var)) end super end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
request-log-analyzer-1.13.4 | lib/request_log_analyzer/class_level_inheritable_attributes.rb |
request-log-analyzer-1.13.3 | lib/request_log_analyzer/class_level_inheritable_attributes.rb |