tainbox 1.2.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +3 -3
- data/lib/tainbox/class_methods.rb +5 -3
- data/lib/tainbox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 587d2c7eaf022075b72228971c55ff7bf82b44e3
|
4
|
+
data.tar.gz: 7211a25c69d04a92b4df7ff41e196246bd1fb785
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3a2dbb3569b68aa02ca22744affdba95503fce446822a6ef0c3aa68ffe535f5ab372fe077c51868741ec0525e33fd66aec735ff8c0457a83ffd3c32a25d14f4
|
7
|
+
data.tar.gz: 23a7c04b92cdcc42de4efb1e5f6f054dbf190a052516076fb26073cfccd969ef229ecab3d2799080356bf05fd53973a7e8637e16e798acc359ca411e54cd6a27
|
data/CHANGELOG.md
CHANGED
@@ -41,3 +41,8 @@ avoid automatic casting from double star parameters
|
|
41
41
|
## 1.2.0
|
42
42
|
|
43
43
|
* Attributes can be assigned via any object which responds to `to_h`
|
44
|
+
|
45
|
+
## 2.0.0
|
46
|
+
|
47
|
+
* Replace `readonly` and `writeonly` options with `reader` and `writer` options for better
|
48
|
+
semantics
|
data/README.md
CHANGED
@@ -72,15 +72,15 @@ person.attribute_provided?(:age) # => false
|
|
72
72
|
person.attribute_provided?(:name) # => true
|
73
73
|
```
|
74
74
|
|
75
|
-
###
|
75
|
+
### Disabling automatic attribute readers and writers
|
76
76
|
|
77
77
|
Speaks for itself:
|
78
78
|
|
79
79
|
``` ruby
|
80
80
|
class Person
|
81
81
|
include Tainbox
|
82
|
-
attribute :name,
|
83
|
-
attribute :age,
|
82
|
+
attribute :name, reader: false
|
83
|
+
attribute :age, writer: false
|
84
84
|
end
|
85
85
|
```
|
86
86
|
|
@@ -22,10 +22,12 @@ module Tainbox::ClassMethods
|
|
22
22
|
|
23
23
|
def attribute(name, type = nil, **args)
|
24
24
|
args = args.dup
|
25
|
-
|
25
|
+
define_reader = args.fetch(:reader, true)
|
26
|
+
define_writer = args.fetch(:writer, true)
|
27
|
+
|
26
28
|
definer = Tainbox::AttributeDefiner.new(self, name, type, args)
|
27
|
-
definer.define_getter
|
28
|
-
definer.define_setter
|
29
|
+
definer.define_getter if define_reader
|
30
|
+
definer.define_setter if define_writer
|
29
31
|
end
|
30
32
|
|
31
33
|
def suppress_tainbox_initializer!
|
data/lib/tainbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tainbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Gubitskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|