Skip to content

Instantly share code, notes, and snippets.

@achempion
Created January 27, 2015 08:43
Show Gist options
  • Save achempion/013528bb2c215af28779 to your computer and use it in GitHub Desktop.
Save achempion/013528bb2c215af28779 to your computer and use it in GitHub Desktop.
православный манкипатчинг
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