README.md in uber-0.0.13 vs README.md in uber-0.0.14
- old
+ new
@@ -2,10 +2,12 @@
_Gem-authoring tools like class method inheritance in modules, dynamic options and more._
## Installation
+[![Gem Version](https://badge.fury.io/rb/uber.svg)](http://badge.fury.io/rb/uber)
+
Add this line to your application's Gemfile:
```ruby
gem 'uber'
```
@@ -53,12 +55,25 @@
```
It's similar to ActiveSupport's `class_attribute` but with a simpler implementation.
It is less dangerous. There are no restrictions for modifying the attribute. [compared to `class_attribute`](http://apidock.com/rails/v4.0.2/Class/class_attribute).
-This module is used across several other gems like [Cells](https://rubygems.org/gems/cells), [Representable](https://rubygems.org/gems/representable), [Roar](https://rubygems.org/gems/roar) and [Reform](https://rubygems.org/gems/reform).
+## Uncloneable Values
+`::inheritable_attr` will `clone` values to copy them to subclasses. Uber won't attempt to clone `Symbol`, `nil`, `true` and `false` per default.
+
+If you assign any other unclonable value you need to tell Uber that.
+
+```ruby
+class Song
+ extend Uber::InheritableAttr
+ inheritable_attr :properties, clone: false
+```
+
+This won't `clone` but simply pass the value on to the subclass.
+
+
# Dynamic Options
Implements the pattern of defining configuration options and dynamically evaluating them at run-time.
Usually DSL methods accept a number of options that can either be static values, symbolized instance method names, or blocks (lambdas/Procs).
@@ -149,9 +164,19 @@
value.evaluate(context, -122.18) #=> 0
```
Use `Options::Value#evaluate` to handle single values.
+
+If the `Value` represents a lambda and is `evaluate`d with `nil` as context, the block is called in the original context.
+
+```ruby
+volume = 99
+value = Uber::Options::Value.new(lambda { volume })
+
+value.evaluate(nil) #=> 99
+```
+
## Performance
Evaluating an options hash can be time-consuming. When `Options` contains static elements only, it behaves *and performs* like an ordinary hash.