Raise error when monkey patching ruby
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
tasks
.document
.gitignore
.rubocop.yml
.ruby-version
.travis.yml
Gemfile
README.md
Rakefile
no_patch.gemspec

README.md

NoPatch

Prevent monkey patching of classes

Installation

Add this line to your application's Gemfile:

gem "no_patch"

And then execute:

$ bundle

Or install it yourself as:

$ gem install no_patch

Usage

Include it as a module to any class.

class MyClass
  include NoPatch
end

Now, it should raise errors when redefining a method that is already existent.

class MyClass
  def foo
    puts "all good here"
  end
end
# => :foo

class MyClass
  def foo
    puts "Redefining"
  end
end

#=> raises NoPath::RedifinitionError

Code Status

Build Status Code Climate Test Coverage

Contributing

  1. Fork it ( https://github.com/[my-github-username]/no_patch/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request