valued 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +22 -0
- data/lib/valued/version.rb +1 -1
- data/lib/valued.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6896d2f520dec61ad2c41b8b03ec227410480d26629fa030ed116f854deb10c
|
4
|
+
data.tar.gz: b22366e310251383cb1ebbb50ff6f39b49a6e479ef61820d8dae78b6375d7812
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea866283956880c3b2930a306333fc88df70461eba90454a517da8867abf62987d79f38477a7ba2635b628ff7189012a8e14d26163386785bf37667488a42b3a
|
7
|
+
data.tar.gz: 5bef6b84951f6c5b6db5c16ae00a7e6db76f426decb3542311ac49688d1c0bbb748f462b972ef076ee3b27e506a3cdeaab2d66d496b7dbd2f94509d11925138b
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -82,6 +82,28 @@ p quantity
|
|
82
82
|
=> #<Quantity amount=2 unit="m">
|
83
83
|
```
|
84
84
|
|
85
|
+
For a mutable object, just use `Valued::Mutable` instead of `Valued`.
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
require 'valued'
|
89
|
+
|
90
|
+
class Quantity
|
91
|
+
include Valued::Mutable
|
92
|
+
|
93
|
+
attributes :unit, :amount
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
By doing that, you also get a setter for every attribute.
|
98
|
+
|
99
|
+
```ruby
|
100
|
+
quantity = Quantity.new
|
101
|
+
quantity.amount = 2
|
102
|
+
quantity.unit = 'm'
|
103
|
+
p quantity
|
104
|
+
=> #<Quantity amount=2 unit="m">
|
105
|
+
```
|
106
|
+
|
85
107
|
## License
|
86
108
|
|
87
109
|
The gem is available as open source under the terms of the
|
data/lib/valued/version.rb
CHANGED
data/lib/valued.rb
CHANGED