Browse files

Clarifies `#to_interval` extensions

  • Loading branch information...
1 parent 6433887 commit 605f7933506d0d8f5c69e72c1a8c2163c393e8ad @badosu committed Apr 9, 2012
Showing with 6 additions and 4 deletions.
  1. +6 −4 README.md
View
10 README.md
@@ -42,12 +42,14 @@ An Interval can be initialized with an empty, one or two sized array
```
Another way to initialize an Interval is by using the
- **to_interval** method on Ranges or Numbers.
+ `#to_interval` method extension.
```ruby
- 1.to_interval
- (0..1).to_interval
- (0...2).to_interval
+ nil.to_interval # -> Interval[]
+ 1.to_interval # -> Interval[1]
+ (1..2).to_interval # -> Interval[1,2]
+ (1...3).to_interval # -> Interval[1,2]
+ [1,2].to_interval # -> Interval[1,2]
```
The **Infinity** constant is available for specifying intervals

0 comments on commit 605f793

Please sign in to comment.