README.md in usable-1.0.0 vs README.md in usable-1.1.0

- old
+ new

@@ -1,8 +1,9 @@ -# Usable +# Usable [![Gem Version](https://badge.fury.io/rb/usable.svg)](http://badge.fury.io/rb/usable) -Rack style mixins for Ruby objects. Mount your modules like you mean it! +A simple way to mount and configure your modules. Usable gives you control over which methods are included, and the class +level config provides a safe interface for calling them. ```ruby module VersionKit def save_version "Saving up to #{self.class.usable_config.max_versions} versions to #{self.class.usable_config.table_name}" @@ -24,26 +25,26 @@ >> Model.usable_config.table_name => "custom_versions" >> Model.new.save_version => "Saving up to 10 versions to custom_versions" ->> Model.usable_config.available_methods[:save_version].bind(self).call +>> Model.usable_config.available_methods[:save_version].bind(Model.new).call => "Saving up to 10 versions to custom_versions" >> Model.new.respond_to? :destroy_version => false ->> Model.usable_config.available_methods[:destroy_version].bind(self).call +>> Model.usable_config.available_methods[:destroy_version].bind(Model.new).call => nil ``` What's going on here? Well `#save_versions` is now extended onto the `Model` class, but `#destroy_version` is not! ## But wait, you undefined my methods? Yes. Well ... yes, at least on the copy of the module included in the target class. But, checking if an object responds to a method all time doesn't produce very [confident code](http://www.confidentruby.com/). That's why it is encouraged to reference methods through the `Model.usable_config.available_methods` hash. This way you can confidently call methods, -just don't rely on the return value! Methods that are removed via `:only` will return `nil`. +just don't rely on the return value, because methods that are removed via `:only` will return `nil`. -## Seperate included module from configurable methods +## Separate included module from configurable methods Sometimes you want to define methods on the module but not have them be configurable. Define a module within the usable module namespace and name it `UsableSpec`, and `Usable` will use that module to configure the available methods. Any naming conflicts will be resolved by giving precedence to the parent module.