README.md in usable-1.2.0 vs README.md in usable-1.2.1

- old
+ new

@@ -1,6 +1,6 @@ -# Usable [![Gem Version](https://badge.fury.io/rb/usable.svg)](http://badge.fury.io/rb/usable) +# Usable [![Gem Version](https://badge.fury.io/rb/usable.svg)](http://badge.fury.io/rb/usable) [![Build Status](https://travis-ci.org/ridiculous/usable.svg)](https://travis-ci.org/ridiculous/usable) [![Code Climate](https://codeclimate.com/github/ridiculous/usable/badges/gpa.svg)](https://codeclimate.com/github/ridiculous/usable) A simple way to mount and configure your modules. Usable gives you control over which methods are included, and a simple interface to help you call dynamic methods with confidence. ```ruby @@ -29,30 +29,30 @@ model = Model.new model.save_version # => "Saving up to 10 versions to custom_versions" model.destroy_version # => NoMethodError: undefined method `destroy_version' for #<Model:... ``` -You'll notice that `#save_versions` is now included on `Model`, but `#destroy_version` isn't defined. +`Model` now has a `#save_versions` method but no `#destroy_version` method. ## Confidently calling methods -We should all be writing [confident code](http://www.confidentruby.com/). That's why it is encouraged -to reference methods through the `usable_method` class level function. Methods passed in with the `:only` option -will always return `nil` when called. +We should all be writing [confident code](http://www.confidentruby.com/), which is why you might want to call configurable +methods through the `usable_method` class level function. Methods passed in with the `:only` option +will _always_ return `nil` when called. Thus, the confidence. Here's the same example as above, rewritten to call methods through the Usable interface: ```ruby Model.usable_method(model, :save_version).call # => "Saving up to 10 versions to custom_versions" Model.usable_method(model, :destroy_version).call # => nil ``` -## Separate included module from configurable methods +## Separate the _included_ module from the _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. +Sometimes you want to define methods on a module and have them always be included. To do this, define a module named +`UsableSpec` in the scope of the module you are mounting. `Usable` will detect this and use he "spec" module to configure +the available methods. Any naming conflicts will be resolved by giving precedence to the parent module. For example: ```ruby module Mixin @@ -62,11 +62,11 @@ def from_mixin "always here" end - # @description Usable will apply the :only to just the methods defined by this module + # @description Usable will apply the :only option to just the methods defined by this module module UsableSpec def from_spec "can be excluded" end @@ -85,10 +85,10 @@ Example.new.from_mixin # => "always here" Example.new.name # => "defined by Mixin" Example.ancestors # => [Example, Mixin, Example::MixinUsableSpecUsed, Object, Kernel, BasicObject] (ruby -v 2.3.0) ``` -Noticed that Usable assigns the modified module to a constant with the same name as the given module, but with "Used" appended. +Notice that Usable assigns the modified module to a constant with the same name as the given module, but with "Used" appended. The main module and the spec were both included, but `Mixin` was not modified, so it didn't need a new name. ## Installation Add this line to your application's Gemfile: