Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yulii committed Sep 19, 2016
1 parent 58b9a6f commit 718b1da
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,28 @@ Include Mixin::Enum and define constants on the module. You can see [the example


```ruby
module Status
module StatusCode
include Mixin::Enum

REQUESTED = 1
IN_PROGRESS = 2
UNDER_REVIEW = 3
APPROVED = 4
REJECTED = 5
CANCELLED = 6
enumerated do
set(:REQUESTED, 1)
set(:IN_PROGRESS, 2)
set(:UNDER_REVIEW, 3)
set(:APPROVED, 4)
set(:REJECTED, 5)
set(:CANCELLED, 6)
end
end

irb> StatusCode::REQUESTED
=> 1
irb> StatusCode.values
=> [1, 2, 3, 4, 5, 6]
irb> StatusCode.all
=> {:REQUESTED=>1, :IN_PROGRESS=>2, :UNDER_REVIEW=>3, :APPROVED=>4, :REJECTED=>5, :CANCELLED=>6}
```


## Development

After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
Expand Down

0 comments on commit 718b1da

Please sign in to comment.