README.md in enum_ish-1.0.0 vs README.md in enum_ish-1.1.0
- old
+ new
@@ -46,10 +46,12 @@
```ruby
user = User.new
user.status = 'enable'
user.status_text #=> "有効"
User.status_options #=> [["有効", "enable"], ["無効", "disable"]]
+User.status_options(only: 'enable') #=> [["有効", "enable"]]
+User.status_options(except: 'enable') #=> [["無効", "disable"]]
```
### Additional translations
Define additional translations:
@@ -84,9 +86,22 @@
enum_ish :status, ['enable', 'disable'], default: 'enable'
end
user = User.new
user.status #=> "enable"
+```
+
+Use default value with block:
+
+```ruby
+class User
+ extend EnumIsh
+ attr_accessor :status, :flag
+ enum_ish :status, ['enable', 'disable'], default: -> { flag ? 'enable' : 'disable' }
+end
+
+user = User.new
+user.status #=> "disable"
```
### Predicates
Generate predicate methods: