eigindir 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 24a9492c57c213577087d60572579217a45fe396
4
- data.tar.gz: b8261b8ef108d9ca72605c75a87f1e8316d07de7
3
+ metadata.gz: 2857c676f78ba1237fce472c7ca0fbc228f47207
4
+ data.tar.gz: 5e20e1350e6b3e5d87f299cb1643144488010417
5
5
  SHA512:
6
- metadata.gz: 30eccc51870543bce60073bbaae098aa676e35d32aceec07ae5b33555fc07b205266d56c7beeaefb536d3f1bc1d2d8d65a43248fbe86ff886a170324d0b58b35
7
- data.tar.gz: f9246a32e33ccf2f70fb2913bfd57c8b8c5f30cc7339960a6d883f46b009f10a319f5776a99e763eb82cb0260ffdd064d78949cbf6c34c53494bde507813de97
6
+ metadata.gz: 07f91b296c273ecc2ef0fb3faf1effdff82dec5831e1470a2303f42a65c38a34048cf358cdc1307a68e7fa367da42f726ab46dfb8b69a11e3dea320cf8155f42
7
+ data.tar.gz: ec8c980f1a8d3dfd95ab9b8b07d52f22f8f640bc6b786f05c2095d3a15b1402bc8fa9be0c842c592617df3c5508151a2c3f2bdf359cde032a4008eac43635a0f
data/README.md CHANGED
@@ -235,7 +235,7 @@ Because `nil` stands for *nothing*, it is not coerced by default:
235
235
  class Foo
236
236
  include Eigindir
237
237
 
238
- attribute :bar, coerce: &:to_s
238
+ attribute :bar, coerce: ->(value) { value.to_s }
239
239
  end
240
240
 
241
241
  foo = Foo.new
@@ -250,7 +250,7 @@ Use `strict: true` option to coerce `nil` as well:
250
250
  class Foo
251
251
  include Eigindir
252
252
 
253
- attribute :baz, coerce: &:to_s, strict: true
253
+ attribute :baz, coerce: ->(value) { value.to_s }, strict: true
254
254
  end
255
255
 
256
256
  foo = Foo.new
@@ -54,15 +54,13 @@ module Eigindir
54
54
 
55
55
  def __readers
56
56
  @__readers ||= begin
57
- default = superclass.send :__readers if superclass.is_a? Eigindir::API
58
- default || []
57
+ (superclass.send(:__readers).dup if superclass.is_a? Eigindir::API).to_a
59
58
  end
60
59
  end
61
60
 
62
61
  def __writers
63
62
  @__writers ||= begin
64
- default = superclass.send :__writers if superclass.is_a? Eigindir::API
65
- default || []
63
+ (superclass.send(:__writers).dup if superclass.is_a? Eigindir::API).to_a
66
64
  end
67
65
  end
68
66
 
@@ -4,6 +4,6 @@ module Eigindir
4
4
 
5
5
  # The semantic version of the module.
6
6
  # @see http://semver.org/ Semantic versioning 2.0
7
- VERSION = "0.0.2".freeze
7
+ VERSION = "0.0.3".freeze
8
8
 
9
9
  end # module Eigindir
@@ -55,8 +55,13 @@ describe Eigindir do
55
55
  it "returns attributes defined in superclass" do
56
56
  parent = Class.new { include Eigindir }
57
57
  parent.attribute :foo, coerce: ->(_) { 1 }, strict: true
58
- instance = Class.new(parent).new
59
- expect(instance.attributes).to eq(foo: 1)
58
+ klass = Class.new(parent) { attribute :bar }
59
+
60
+ pater = parent.new
61
+ child = klass.new
62
+
63
+ expect(pater.attributes).to eq(foo: 1)
64
+ expect(child.attributes).to eq(foo: 1, bar: nil)
60
65
  end
61
66
 
62
67
  end # describe #attributes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eigindir
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kozin