Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
odedniv committed Apr 28, 2013
1 parent dca88d6 commit 25ceec5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# nil_or

Delegates methods to the target unless nil.

## Getting started

$ gem install nil_or

Or in your Gemfile:

gem "nil_or"

## Usage

When x is not nil:

x = 5
x.nil_or.to_s
=> "5"
x.nil_or + 2
=> 7
x.nil_or.times { |i| puts i }
...

But when it is nil:

x = nil
x.nil_or.to_s
=> nil
x.nil_r + 2
=> nil
x.nil_or.shakalaka(1, 2) { does_nothing }
=> nil

0 comments on commit 25ceec5

Please sign in to comment.