Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Core extensions lib with explicit patching
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
Gemfile
LICENSE.txt
README.md
Rakefile
footing.gemspec

README.md

Lines of Code Code Status Dependency Status Build Status Coverage Status Downloads

Footing

Footing provides some sanity for monkey patching practices.

It's also a utility lib that contains additional functionality for core objects that you might find useful. Think of it as a lightweight version of ActiveSupport that doesn't implicitly change native behavior.

No implicit monkey patching

You must explicitly apply monkey patches.

Footing.patch! String, Footing::String
Footing.patch! Numeric, Footing::Numeric

Patches are visible in the classes ancestry.

String.ancestors
[
  String,
  Footing::String, # <--
  Comparable,
  Object,
  Kernel,
  BasicObject
]

Numeric.ancestors
[
  Numeric,
  Footing::Numeric, # <--
  Comparable,
  Object,
  Kernel,
  BasicObject
]

Instance patching

If you don't want to corrupt the entire runtime, you can patch an instance.

s = "foo"
Footing.patch! s, Footing::String
s.respond_to? :escape     # => true
"foo".respond_to? :escape # => false

Patch free

Dont like monkey patches? Run patch free by setting up utility methods instead.

Footing.util! Footing::String
Footing::String.escape "foo", "o" # => "f\\o\\o"

The Library

The suite of functionality is pretty small right now. Poke around the extensions directory to see what's available.

Pull requests welcome.

Something went wrong with that request. Please try again.