README.md in koine-attributes-0.2.0 vs README.md in koine-attributes-0.2.1
- old
+ new
@@ -80,11 +80,11 @@
end
end
person = Person.new(name: 'John Doe', birthday: '2001-01-31')
- foo: attribute will raise error
+ # foo: attribute will raise error
person = Person.new(name: 'John Doe', birthday: '2001-01-31', foo: :bar)
```
You can disable strict mode
@@ -108,10 +108,12 @@
attributes do
attribute :price, MyCustom::Money.new
attribute :available, :boolean, ->(attribues){ attributes.with_default_value(true) }
attribute :available, Koine::Attributes::Drivers::Boolean.new.with_default_value(true)
+ attribute :tags, array_of(:string)
+ attribute :config, hash_of(:symbol, :string)
end
end
product = Product.new
@@ -119,10 +121,14 @@
product.available = 0
product.available # => false
product.price = { currency: 'USD', value: 100 }
+product.tags = ['new']
+
+product.config = { short_url: 'http://config.url' }
+
# or
product.price = "100 USD"
```
```ruby
@@ -165,14 +171,18 @@
```
### Standard types
```ruby
-:boolean, ->(adapter) { adapter.append_true_value('yes').append_false_value('no') }
+:any
+:array_of
+:boolean
:date
:float
+:hash_of
:integer
:string
+:symbol
:time
```
### Alternative solutions