To prevent use of your private API, this gem allow you to mark methods as being fucking_private
and/or fucking_final
.
class Example
include FuckOff
fucking_private def foo
"Foo"
end
fucking_final def bar
"Bar"
end
end
If you try to call a fucking_private
method anyway, it will raise a NoMethodError
.
Example.new.send(:foo) # raises a FuckOff::NoMethodError
If you try to redefine a fucking_final
method, it will raise a NameError
.
Example.define_method(:bar) { "New bar" } # raises a FuckOff::NameError
Yes, this is a joke. But it also kind of works.