A collection of useful monkey patches for your projects.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install eb-patches
In Rails, in your
config/application.rb file, you selectively choose
which patches you want to be included.
Patches can be applied by using the following pattern:
Eb.monkey_patch <class>, "<method>" # or Eb.monkey_patch <class>, :<method>
Eb.monkey_patch Float, "approx" # or Eb.monkey_patch Float, :approx
The patches are as follows:
approx- check if about the same as another given number based on float's epsilons - whee floats!
methodize- get a stripped, snake-cased, downcased version of the string
down_under- same as methodize
filename_sanitize- get a version of the string that is usable as a filename on basically any OS made since Windows 2000
before?- is this time before another time?
after?- is this time after another time?
force_tls- force TLS to be used, even for smtp services that don't advertise it. Note: this will also cause the initializer to be aliased so TLS can be enabled.
reset_tls- call this to allow Net::SMTP to automatically determine if TLS should be used. This will have no effect if force_tls hasn't been included already since it doesn't have any meaning otherwise
in?- this is intended to be used in situations where you might use
.include?-- and is in fact just calling it under the covers
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Added some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request
Maintained by Expected Behavior
Released under the MIT license. http://github.com/expected-behavior/eb-patches