attr_permit 0.0.3 → 0.0.4

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: f4d534037b060cc2a56910ea66ffcf2fe20c4d1d
4
- data.tar.gz: 3aa06e273bf5c3d6d06f245dfbe6963dc2d1d439
3
+ metadata.gz: 0635e65bf5caef54303d9020566c69196f533e46
4
+ data.tar.gz: 0b3e4132aa19cbefc1fd5945a7c0791064e6a485
5
5
  SHA512:
6
- metadata.gz: 324b9d1f6190cb54d3fe1dae24bc883095fb58f33c3c3d6e8be2f01562ab1dbcd46f7a53e7c013941fe23f657f3bc03708d1a2d5d4cc136adab94fd5ea0bfa32
7
- data.tar.gz: f0c5b34709b0944c5e7b3b88e77fc8d497d0a422045874f484ce611a12ad499f8b45e6f44945d6a0f1c4868e5b3bed882c875accd14df73922a7902d9bdc3eb2
6
+ metadata.gz: 8f21fb52b2a6f401fb75980b5a8a2e1ba71325c7690b4f7969dbe2f4e5621874a7cb38d666bbb5ca9ae9afe74e7564c7aaed1f4b9b679638b7fd6007b2c6a7b7
7
+ data.tar.gz: d80ec9296178eedefcde72e949ffa6130646591e337a78566c846e468cffc207093ff049ba1e5ab3d4185d49842a805c902271ae152abff0883a0141760ea636
@@ -34,7 +34,7 @@ class AttrPermit
34
34
  self.mapped_methods.concat [*to, *get_super_mapped_methods]
35
35
  if from.is_a? Proc
36
36
  send(:define_method, to) do
37
- instance_exec(&from)
37
+ source.instance_exec(&from)
38
38
  end
39
39
  else
40
40
  send(:define_method, to) do
@@ -1,3 +1,3 @@
1
1
  class AttrPermit
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -214,10 +214,10 @@ RSpec.describe AttrPermit, unit: true do
214
214
 
215
215
  it 'will call proc from map' do
216
216
  class MapAttributeTwo < AttrPermit
217
- map_attribute :my_attr, -> { source.item }
217
+ map_attribute :my_attr, -> { item.thing }
218
218
  end
219
219
 
220
- expect(MapAttributeTwo.new(OpenStruct.new(item: 'My Item')).my_attr).to eq 'My Item'
220
+ expect(MapAttributeTwo.new(OpenStruct.new(item: OpenStruct.new(thing: 'My Item'))).my_attr).to eq 'My Item'
221
221
  end
222
222
 
223
223
  end
@@ -256,7 +256,7 @@ RSpec.describe AttrPermit, unit: true do
256
256
 
257
257
  it 'will call proc from map' do
258
258
  class MapAttributeTwo < AttrPermit
259
- map_attributes :my_attr => -> { source.item }
259
+ map_attributes :my_attr => -> { item }
260
260
  end
261
261
 
262
262
  expect(MapAttributeTwo.new(OpenStruct.new(item: 'My Item')).my_attr).to eq 'My Item'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attr_permit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus