active_record_schema_scrapper 0.1.1 → 0.1.2

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: ad8b72a1fd99a6cc14f70a87ec35f42870f26a2c
4
- data.tar.gz: 8fd34f4c58f20e2678b9468e86f0a624afb11f22
3
+ metadata.gz: fd1b57d1f85ff5c858486752ed97ff2a83800ffc
4
+ data.tar.gz: b80d941344f8bc4a7821b876dfbf9ec634504c9a
5
5
  SHA512:
6
- metadata.gz: 5f63130533253906f4b03f29ff7fad8c1f69db8d07b073e206e8d3de760c30f77d8939959282d6e4a40fa332db496576bd195c55b858b2b56aac7d9475261560
7
- data.tar.gz: 0e49306e9cd3caf0b506dbe905ca80a771372e275c2e0b42e3181b1a1e144e06eada0bb7d2bbe7a1ad01ecfa7dfb943e0789e82bd5a5a001588b200ebc248216
6
+ metadata.gz: 074306e429e870119dda643b8dd915ec370413ec4df0100a43d5546e0aa75502beac48213d6a8dd6180836e7e0ddbe69449184f2317d8a50541ef60a15416a47
7
+ data.tar.gz: a3da99ad3a1a02677a5dd680a57704548a0a09d71beb21b2165fd727a576ee4a89322bd1a06c25832a1d2c7e10961c61d888e3d60654f31a61ef6c113d709151
@@ -21,16 +21,16 @@ class ActiveRecordSchemaScrapper
21
21
  { source: a.try(:delegate_reflection).try(:name),
22
22
  through: a.try(:through),
23
23
  dependent: a.options[:dependent] }
24
- end.merge({
25
- name: a.name,
26
- foreign_key: a.foreign_key,
27
- class_name: a.klass.name,
28
- type: type,
29
- })
24
+ end.merge(name: a.name,
25
+ foreign_key: a.foreign_key,
26
+ class_name: a.klass.name,
27
+ type: type)
30
28
 
31
29
  yield(ActiveRecordSchemaScrapper::Association.new(hash))
32
30
  rescue NameError => e
33
- errors << "Missing model #{a.name.to_s.camelize} for association #{model.name}.belongs_to :#{a.name}"
31
+ errors << OpenStruct.new(class_name: model.name,
32
+ message: "Missing model #{a.name.to_s.camelize} for association #{model.name}.belongs_to :#{a.name}",
33
+ original_error: e)
34
34
  end
35
35
  end
36
36
  end
@@ -2,7 +2,8 @@ class ActiveRecordSchemaScrapper
2
2
  class Attributes
3
3
 
4
4
  def initialize(model:)
5
- @model = model
5
+ @model = model
6
+ @errors = []
6
7
  end
7
8
 
8
9
  include Enumerable
@@ -31,6 +32,8 @@ class ActiveRecordSchemaScrapper
31
32
  @registered_defaults ||= []
32
33
  end
33
34
 
35
+ attr_reader :errors
36
+
34
37
  private
35
38
 
36
39
  attr_reader :model
@@ -47,6 +50,10 @@ class ActiveRecordSchemaScrapper
47
50
  null: v.null,
48
51
  )
49
52
  end
53
+ rescue NoMethodError => e
54
+ @errors << OpenStruct.new(class_name: model.name,
55
+ message: "#{model.name} is not a valid ActiveRecord model.",
56
+ original_error: e)
50
57
  end
51
58
  end
52
59
  end
@@ -1,3 +1,3 @@
1
1
  class ActiveRecordSchemaScrapper
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_schema_scrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-18 00:00:00.000000000 Z
11
+ date: 2015-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus