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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39d0af0651b569f4cf39ab09ff548bed085d5f8e
4
- data.tar.gz: 5e4489e525acb6aacf0e556a9aacc3d10b728ff7
3
+ metadata.gz: 587d2c7eaf022075b72228971c55ff7bf82b44e3
4
+ data.tar.gz: 7211a25c69d04a92b4df7ff41e196246bd1fb785
5
5
  SHA512:
6
- metadata.gz: 6b75710793915d64186e2ab032c01fa9565beb6d3f61c8dc51ceec0bb2be6226af41bea9dc8cb59d3ebb241462e07a87caaeee89c6262dc827facb93db7345dc
7
- data.tar.gz: 8ee07e46b06606b418373d54d296514136ac8147d34ae264f6d6241a85165c5ac2af9628a06329b7750bf631522e61cf8f103245fa11c8c57e3836be16bafe9e
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
- ### Readonly and writeonly attributes
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, writeonly: true
83
- attribute :age, readonly: true
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
- readonly, writeonly = args.delete(:readonly), args.delete(:writeonly)
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 unless writeonly
28
- definer.define_setter unless readonly
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!
@@ -1,3 +1,3 @@
1
1
  module Tainbox
2
- VERSION = '1.2.0'
2
+ VERSION = '2.0.0'
3
3
  end
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: 1.2.0
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-06 00:00:00.000000000 Z
11
+ date: 2016-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport