README.md in koine-attributes-0.1.0 vs README.md in koine-attributes-0.1.1
- old
+ new
@@ -1,14 +1,18 @@
# Koine::Attributes
Strong attributes for ruby ruby objects.
+Yes, there are [so many alternative solutions already](#alternative-solutions)! Why then? Cause some times people need distractions at the airports.
+
[![Build Status](https://travis-ci.org/mjacobus/koine-attributes.svg?branch=master)](https://travis-ci.org/mjacobus/koine-attributes)
[![Coverage Status](https://coveralls.io/repos/github/mjacobus/koine-attributes/badge.svg?branch=master)](https://coveralls.io/github/mjacobus/koine-attributes?branch=master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mjacobus/koine-attributes/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mjacobus/koine-attributes/?branch=master)
[![Code Climate](https://codeclimate.com/github/mjacobus/koine-attributes/badges/gpa.svg)](https://codeclimate.com/github/mjacobus/koine-attributes)
[![Issue Count](https://codeclimate.com/github/mjacobus/koine-attributes/badges/issue_count.svg)](https://codeclimate.com/github/mjacobus/koine-attributes)
+
+[![Gem Version](https://badge.fury.io/rb/koine-attributes.svg)](https://badge.fury.io/rb/koine-command_bus)
[![Dependency Status](https://gemnasium.com/badges/github.com/mjacobus/koine-attributes.svg)](https://gemnasium.com/github.com/mjacobus/koine-attributes)
## Installation
Add this line to your application's Gemfile:
@@ -27,12 +31,10 @@
## Usage
```ruby
class Person
- include Koine::Attributes
-
attributes do
attribute :name, :string
attribute :birthday, :date
# or
@@ -61,12 +63,10 @@
Also, a constructor can be created by the API
```ruby
class Person
- include Koine::Attributes
-
attributes initializer: true do
attribute :name, :string
attribute :birthday, :date
end
end
@@ -79,12 +79,10 @@
You can disable strict mode
```ruby
class Person
- include Koine::Attributes
-
attributes initializer: { strict: false } do
attribute :name, :string
attribute :birthday, :date
end
end
@@ -137,35 +135,25 @@
# or
product.price = "100 USD"
```
-### Value objects
-
-```ruby
-class Location
- include Koine::Attributes
-
- attributes initializer: { freeze: true } do
- attribute :lat, :float
- attribute :lon, :float
- end
-end
-
-location = Location.new(lat: 1, lon: 2)
-new_location = location.with_lon(3)
-```
-
### Standard types
```ruby
:boolean, ->(adapter) { adapter.append_true_value('yes').append_false_value('no') }
:date
:float
:integer
:string
:time
```
+
+### Alternative solutions
+
+- [attributed_object](https://github.com/jgroeneveld/attributed_object)
+- [virtus](https://github.com/solnic/virtus)
+- [dry-struct](https://github.com/dry-rb/dry-struct)
## 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.