Skip to content

Commit c83551c

Browse files
authored
Merge pull request #2 from hoppergee/fix_owner_method_redefine
Prevent the owner method to be redefine
2 parents 4de0070 + 2cc02d4 commit c83551c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## [Unreleased]
22

3+
- Change owner method define from `self.calss.define_method` to `self.define_singleton_method`
4+
35
## [1.1.0] - 2022-10-08
46

57
- Support `module_function`

lib/active_method/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __set_owner(owner)
105105
@__method_owner = owner
106106

107107
instance_name = Util.snake_case(owner.class.name.split("::").last)
108-
self.class.define_method instance_name do
108+
self.define_singleton_method instance_name do
109109
@__method_owner
110110
end
111111
end

0 commit comments

Comments
 (0)