activerecord-bixformer 0.3.10 → 0.3.11

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: 06d5ab39dfcb860914026975b5d9418dbbb6a117
4
- data.tar.gz: 50d3b1bd924cfa110b72fe9a28d9a1786fd5b78a
3
+ metadata.gz: 03b0d7b8164b9a2d8df5a3b32a1e6f360a70ef3f
4
+ data.tar.gz: 8c3134805d7d5ac55d0a9d4905ff3a461a1c07ec
5
5
  SHA512:
6
- metadata.gz: 8afbb90d65a314967ae67dedb8aacef4d1e6d3552d469bf4b080ee971268ac0f9b38846e6a0052969544b2829eda3a2067a193b7b222c20cd0d9d8c6bbb8a53b
7
- data.tar.gz: 610b36b3f7660c350fe9342a5d4985137197c77112c86bf8cef56aeab93c4c7f1a5a49467635d251a6749e59b77c9f98bf833912795235fb9e4cd18d6637fb46
6
+ metadata.gz: f5fb1111352e1fe5839f74b477944f64c1072f671d3a65243391e73ce6c72a1879bd22cdb02d4c41e0fc1ec786c2f3ecfb644fb3d2949a1bbb76071364f7866f
7
+ data.tar.gz: f848f2b7b9ad05f9bb235cabca4a8dacb76880527cc4f297385612e10c63bd3cc2d783aa56da99a049ed67f81150b81d383b97497ceadbaa3d465911a6662a5b
@@ -30,7 +30,7 @@ module ActiveRecord
30
30
  formatter = @options[:by]
31
31
 
32
32
  if formatter.is_a?(::Proc)
33
- self.instance_exec foreign_record, &formatter
33
+ formatter.call(foreign_record)
34
34
  else
35
35
  foreign_record.__send__(formatter)
36
36
  end
@@ -39,13 +39,13 @@ module ActiveRecord
39
39
  def import(value)
40
40
  return nil unless value.present?
41
41
 
42
- find_by = @options[:find_by]
43
- scope = @options[:scope] || :all
44
- finder = @options[:finder] || :find_by
45
- creator = @options[:creator] || :save
42
+ find_by = @options[:find_by]
43
+ scope = @options[:scope] || :all
44
+ finder = @options[:finder] || :find_by
45
+ creator = @options[:creator] || :save
46
46
 
47
47
  condition = if find_by.is_a?(::Proc)
48
- self.instance_exec value, &find_by
48
+ find_by.call(value)
49
49
  else
50
50
  { find_by => value }
51
51
  end
@@ -53,20 +53,20 @@ module ActiveRecord
53
53
  return nil unless condition
54
54
 
55
55
  foreign_record = if scope.is_a?(::Proc)
56
- self.instance_exec(&scope).__send__(finder, condition)
56
+ scope.call.__send__(finder, condition)
57
57
  else
58
58
  foreign_constant.__send__(scope).__send__(finder, condition)
59
59
  end
60
60
 
61
61
  if ! foreign_record && @options[:create]
62
62
  foreign_record = if scope.is_a?(::Proc)
63
- self.instance_exec(&scope).build(condition)
63
+ scope.call.build(condition)
64
64
  else
65
65
  foreign_constant.__send__(scope).build(condition)
66
66
  end
67
67
 
68
68
  if creator.is_a?(::Proc)
69
- self.instance_exec foreign_record, &creator
69
+ creator.call(foreign_record)
70
70
  else
71
71
  foreign_record.__send__(creator)
72
72
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bixformer
3
- VERSION = "0.3.10"
3
+ VERSION = "0.3.11"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-bixformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.10
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroaki Otsu