README.md in footing-0.2.3 vs README.md in footing-1.0.0

- old
+ new

@@ -1,71 +1,35 @@ +[![Lines of Code](http://img.shields.io/badge/lines_of_code-87-brightgreen.svg?style=flat)](http://blog.codinghorror.com/the-best-code-is-no-code-at-all/) +[![Code Status](http://img.shields.io/codeclimate/github/hopsoft/footing.svg?style=flat)](https://codeclimate.com/github/hopsoft/footing) +[![Dependency Status](http://img.shields.io/gemnasium/hopsoft/footing.svg?style=flat)](https://gemnasium.com/hopsoft/footing) +[![Build Status](http://img.shields.io/travis/hopsoft/footing.svg?style=flat)](https://travis-ci.org/hopsoft/footing) +[![Coverage Status](https://img.shields.io/coveralls/hopsoft/footing.svg?style=flat)](https://coveralls.io/r/hopsoft/footing?branch=master) +[![Downloads](http://img.shields.io/gem/dt/footing.svg?style=flat)](http://rubygems.org/gems/footing) + # Footing -[![Build Status](https://travis-ci.org/hopsoft/footing.png)](https://travis-ci.org/hopsoft/footing) -[![Dependency Status](https://gemnasium.com/hopsoft/footing.png)](https://gemnasium.com/hopsoft/footing) -[![Code Climate](https://codeclimate.com/github/hopsoft/footing.png)](https://codeclimate.com/github/hopsoft/footing) +An [ActiveSupport](https://github.com/rails/rails/tree/master/activesupport) +style utility library that employs [delegation](https://en.wikipedia.org/wiki/Delegation_(programming)) +instead of [monkey patching](https://en.wikipedia.org/wiki/Monkey_patch). -Footing provides some sanity for monkey patching practices. +__NOTE:__ _The project is structured so that it can support explicit monkey patching if you prefer to use that strategy._ -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. +## Immutabilty -## No implicit monkey patching +Footing employs some principles of [immutability](https://en.wikipedia.org/wiki/Immutable_object) that are common in +[functional programming](https://en.wikipedia.org/wiki/Functional_programming). +The integrity of original objects/data is preserved because Footing creates a deep copy by default. -You must explicitly apply monkey patches. +__NOTE:__ _This behavior can be overridden to improve performance... just be sure you know what you're doing_ -```ruby -Footing.patch! String, Footing::String -Footing.patch! Numeric, Footing::Numeric -``` +## Hash -Patches are visible in the classes ancestry. +### Filter -```ruby -String.ancestors -[ - String, - Footing::String, # <-- - Comparable, - Object, - Kernel, - BasicObject -] +Recursively filter out unwanted values based on key. -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. - ```ruby -s = "foo" -Footing.patch! s, Footing::String -s.respond_to? :escape # => true -"foo".respond_to? :escape # => false +data = { name: "Joe", password: "secret" } +copy = Footing::Hash.new(data) +copy.filter!(:password) +copy.inner_object # => {:name=>"Joe", :password=>"[FILTERED]"} ``` - -## Patch free - -Dont like monkey patches? Run patch free by setting up utility methods instead. - -```ruby -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](https://github.com/hopsoft/footing/tree/master/lib/footing/extensions) to see what's available. - -Pull requests welcome. -