Footing

Build Status Dependency Status Code Climate

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.