active_record_schema_scrapper 0.4.0 → 0.5.0

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: 71ac9fbebc69db610a118ff0b8653d5c3f205d24
4
- data.tar.gz: 69018e554e6d26845da497baf003843eeda34e4d
3
+ metadata.gz: 7df5fa6fd93bbe7079a740148c55fa00e9f9e3f6
4
+ data.tar.gz: 567ae9e5bb444f021e23e90f7132907b9d81b7f9
5
5
  SHA512:
6
- metadata.gz: fb40ede397f3378c6c3775d1fd1e26fb655e5bb1a4e3c8c8a9fe55f9965891021f2736708571f1916a5e678d6dea5dee24572b030d9bd4cfcaea9bc2126bb010
7
- data.tar.gz: 8c1a428a4593e8b596948b22232f69066556ec9fe9b6ed6e9d9eeec2fc33ebb9fd06584412773e600c3dc67243a292e27f0d1d17d1b45be850b8cfad858d95eb
6
+ metadata.gz: 1f00c8d507012e7b7b6c4e50515ae24dcb3602ff1835090f300bc1bdb06fde55fa3b0a980c4c14cc1f04ee04b2bc960b001073e72e899645d9fab6167dd5dadf
7
+ data.tar.gz: e72135d7bbd58958e31545ce9fe02e57135da5cab2d1c1aab1c5652b995483e170f5246e4b583f6d1e3b1fd638bf17a71c9d768152efaf9b64c6f7fccba98411
data/README.md CHANGED
@@ -61,9 +61,9 @@ So any arbitrary type can be registered.
61
61
  )
62
62
 
63
63
  ActiveRecordSchemaScrapper::Attributes.register_default(
64
- name: "{}",
65
- klass: [],
66
- cast_type: -> (c) { c.class.name.include?("Array") }
64
+ default: "{}",
65
+ replacement_default: [],
66
+ cast_type: -> (c) { c.class.name.include?("Array") }
67
67
  )
68
68
 
69
69
  ActiveRecordSchemaScrapper::Attributes.new(model: User).map(&:to_h)
@@ -7,6 +7,11 @@ class ActiveRecordSchemaScrapper
7
7
  @errors = []
8
8
  end
9
9
 
10
+ def errors
11
+ to_a
12
+ @errors
13
+ end
14
+
10
15
  include Enumerable
11
16
 
12
17
  def each
@@ -30,7 +35,7 @@ class ActiveRecordSchemaScrapper
30
35
 
31
36
  yield(ActiveRecordSchemaScrapper::Association.new(hash))
32
37
  rescue NameError => e
33
- errors << ErrorObject.new(
38
+ @errors << ErrorObject.new(
34
39
  class_name: model.name,
35
40
  message: "Missing model #{a.name.to_s.camelize.singularize} for association #{model.name}.belongs_to :#{a.name}",
36
41
  original_error: e,
@@ -50,15 +55,13 @@ class ActiveRecordSchemaScrapper
50
55
  [:has_and_belongs_to_many, :belongs_to, :has_one, :has_many]
51
56
  end
52
57
 
53
- attr_reader :errors
54
-
55
58
  private
56
59
 
57
60
  attr_reader :model, :types
58
61
 
59
62
  def abstract_class
60
63
  if model.abstract_class?
61
- errors << ErrorObject.new(
64
+ @errors << ErrorObject.new(
62
65
  class_name: model.name,
63
66
  message: "#{model.name} is an abstract class and has no associated table.",
64
67
  level: :warn,
@@ -67,4 +70,4 @@ class ActiveRecordSchemaScrapper
67
70
  end
68
71
  end
69
72
  end
70
- end
73
+ end
@@ -76,7 +76,7 @@ class ActiveRecordSchemaScrapper
76
76
  end
77
77
  end
78
78
 
79
- attr_reader :errors, :model
79
+ attr_reader :model
80
80
  private :model
81
81
 
82
82
  def initialize(model:)
@@ -94,6 +94,11 @@ class ActiveRecordSchemaScrapper
94
94
  @to_a ||= map { |v| v }
95
95
  end
96
96
 
97
+ def errors
98
+ to_a
99
+ @errors
100
+ end
101
+
97
102
  private
98
103
 
99
104
  def call
@@ -1,3 +1,3 @@
1
1
  class ActiveRecordSchemaScrapper
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
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.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2016-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord