Skip to content

Commit 7464fc5

Browse files
committed
added info about checking multiple values to readme
1 parent bdfee46 commit 7464fc5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ gem "enum_machine"
5959
```ruby
6060
# With ActiveRecord
6161
class Product < ActiveRecord::Base
62-
enum_machine :color, %w[red green]
62+
enum_machine :color, %w[red green yellow]
6363
end
6464

6565
# Or with plain class
6666
class Product
6767
# attributes must be defined before including the EnumMachine module
6868
attr_accessor :color
6969

70-
include EnumMachine[color: { enum: %w[red green] }]
70+
include EnumMachine[color: { enum: %w[red green yellow] }]
7171
# or reuse from model
7272
Product::COLOR.enum_decorator
7373
end
@@ -85,6 +85,8 @@ product = Product.new
8585
product.color # => nil
8686
product.color = "red"
8787
product.color.red? # => true
88+
product.color.red__yellow? # => true # when color is green or yellow
89+
product.color.green__yellow? # => false
8890
product.color.human_name # => "Красный"
8991
```
9092

0 commit comments

Comments
 (0)