File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ def mattr_inheritable(*args)
29
29
@mattr_inheritable_attrs += args
30
30
31
31
args . each do |arg |
32
- module_eval %(class << self; attr_accessor : #{ arg } end )
32
+ singleton_class . attr_accessor ( arg )
33
33
end
34
34
35
35
@mattr_inheritable_attrs
@@ -42,14 +42,12 @@ def inherited(subclass)
42
42
subclass . instance_variable_set ( ivar , instance_variable_get ( ivar ) . clone )
43
43
44
44
if instance_variable_get ( ivar ) . respond_to? ( :merge )
45
- method = <<-EOM
45
+ subclass . class_eval <<~RUBY , __FILE__ , __LINE__ + 1
46
46
def self.#{ inheritable_attribute }
47
47
duplicate = ModuleInheritableAttributes.hash_deep_dup(#{ ivar } )
48
48
#{ ivar } = superclass.#{ inheritable_attribute } .merge(duplicate)
49
49
end
50
- EOM
51
-
52
- subclass . class_eval method
50
+ RUBY
53
51
end
54
52
end
55
53
end
You can’t perform that action at this time.
0 commit comments