Skip to content

Commit

Permalink
fix: rename singleton_class? to sucker_punch_is_singleton_class? to a…
Browse files Browse the repository at this point in the history
…void naming class with core ruby method (#253)
  • Loading branch information
bethesque authored Dec 11, 2023
1 parent c5d94d0 commit d0f1007
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/sucker_punch/core_ext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def self.#{name}=(val)
define_method(:#{name}) { val }
end
if singleton_class?
if sucker_punch_is_singleton_class?
class_eval do
def #{name}
defined?(@#{name}) ? @#{name} : singleton_class.#{name}
Expand All @@ -42,7 +42,8 @@ def #{name}?
end

private
def singleton_class?

def sucker_punch_is_singleton_class?
ancestors.first != self
end
end
Expand Down

0 comments on commit d0f1007

Please sign in to comment.