Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
православный манкипатчинг
module MyStringThing
refine String do
def at(num)
self[num..num]
end
end
end
class A
using MyStringThing
def fifth(str)
str.at(4)
end
end
class B
def fifth(str)
str.at(4)
end
end
A.new.fifth("qwerty")
# => "t"
B.new.fifth("qwerty")
# NoMethodError: undefined method `at' for "qwerty":String
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.