kartograph 0.2.5 → 0.2.6

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: eaee268ad7c2b736237f01369474cbe6cbee694b
4
- data.tar.gz: 58997d0b1b7ca22e24f1c62f1880ce0b6693a1f9
3
+ metadata.gz: 71c910042ed1e28e5925d425cb66668cbd07f415
4
+ data.tar.gz: 89dbd0a363a63fad5d4100cffa9b6a088ba01b6e
5
5
  SHA512:
6
- metadata.gz: 0b87a9256ab9073fee5c01b9e91c145b1932b9e95a6418798bdcab39fe8f4b4e2b67fc4504b4c0df5ad27e4caf561eab1aa15b78542106b842c9d01fdbbc12ce
7
- data.tar.gz: 0f957cb74f245a213d04d65687808035223be2e3c1eae5e95037c247b325d6a91d0ec963533d7986c6cafb909c1e68dd4d731422a4ff87f43ce09f0420400092
6
+ metadata.gz: 2a5225b1657956962dd98cfd4274f7903fbad3c5bc41a56cb5a6a870b20281d7a596abba9879ca1b9633d2dd2267ffe306cbdfb514c7b630ecb8a9d2cfb1282b
7
+ data.tar.gz: fd9fe190754dae7eadb06aad30f4092deafbca8f570035ee4f5d4dc9f0935a986eeca7ff66905a00280b172c140dee2f4d5205a971fe5016bfd8404d396b4ab8
@@ -1,7 +1,6 @@
1
1
  module Kartograph
2
2
  class Property
3
- attr_reader :name, :options
4
- attr_accessor :map
3
+ attr_reader :name, :options, :map
5
4
 
6
5
  def initialize(name, options = {}, &block)
7
6
  @name = name
@@ -26,6 +25,11 @@ module Kartograph
26
25
  @key
27
26
  end
28
27
 
28
+ def map=(map)
29
+ @map = map
30
+ @artist = Artist.new(@map)
31
+ end
32
+
29
33
  def value_for(object, scope = nil)
30
34
  value = object.send(name)
31
35
  return if value.nil?
@@ -1,4 +1,4 @@
1
1
  module Kartograph
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
4
4
 
@@ -231,5 +231,21 @@ describe Kartograph::Property do
231
231
  expect(duped.options).to_not be(instance.options)
232
232
  expect(duped.options).to eq(instance.options)
233
233
  end
234
+
235
+ context 'setting the map after duping' do
236
+ it 'draws a value' do
237
+ # NOTE: This test is a regression test introduced by caching of Artist instance.
238
+ dummy_class = Struct.new(:id, :name)
239
+ dummy = dummy_class.new
240
+ dummy.id = 123
241
+
242
+ instance = Kartograph::Property.new(:id, scopes: [:read])
243
+ duped = instance.dup
244
+ duped.map = Kartograph::Map.new
245
+ val = duped.value_for(dummy)
246
+
247
+ expect(val).to_not be_nil
248
+ end
249
+ end
234
250
  end
235
251
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kartograph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Ross