codegen 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: 00412649aa3f3df14949235e95b256c74ddda170
4
- data.tar.gz: 5f81b33b6c92717fe0aeb39fb72067284d8bf472
3
+ metadata.gz: d0b58cc33ca1e7f1b22e8dd362633a7444549f29
4
+ data.tar.gz: 4a8612e636bb5a9691912fa8655ac63b3086ecc4
5
5
  SHA512:
6
- metadata.gz: e6dd254abcfb42d313faaf4d08c4f1e7760845e18e3c627185133af3298aca8d6d4fcf25d0e2eefbf8927baf680f1c7735692746642341147b10a0799ce39e9b
7
- data.tar.gz: 950eeae2ead783e7223fedbe12a17ee3095477029950a1830ce1db7e17ee58b1c2836a6945b61a0b556abbf2fab3123439c01416a08dc3eae734a12a9b9d3a66
6
+ metadata.gz: 4df1d0a09d4aa33133d4310a96c2cc2468e81865f48bae77ae0937145e2ff24f1624ecce52e70995ec386eb649cf04d26bcc84f82ba08a66861a0f2f92a09907
7
+ data.tar.gz: 981bc92c47980c0be407cec0ac3ab6d6e63c9a98499137822af7031c639bb58a36504514b1001b0425bfdbd3debf78a9758dddc5565a2766dca19e31457a9ac3
@@ -1,5 +1,9 @@
1
+
2
+
1
3
  module Codegen
2
4
  module Sources
5
+
6
+
3
7
  class ActiveRecord < Base
4
8
 
5
9
  converts_to :entity
@@ -15,12 +19,16 @@ module Codegen
15
19
  models = options[:models] || collect_all_models
16
20
  models_and_methods = models.map { |model|
17
21
  {
18
- model => {
19
- methods: model_methods(model),
20
- relations: model_relations(model)
21
- }
22
+ begin
23
+ model => {
24
+ methods: model_methods(model),
25
+ relations: model_relations(model)
26
+ }
27
+ rescue Exception => e
28
+ nil
29
+ end
22
30
  }
23
- }
31
+ }.filter { |x| x.nil? }
24
32
 
25
33
  models_and_methods.map { |mm|
26
34
  model_to_entity(mm)
@@ -71,7 +79,7 @@ module Codegen
71
79
  def collect_all_models
72
80
  begin
73
81
  Rails.application.eager_load! if defined?(Rails)
74
- ActiveRecord::Base.subclasses
82
+ ::ActiveRecord::Base.subclasses
75
83
  rescue
76
84
  []
77
85
  end
@@ -1,3 +1,3 @@
1
1
  module Codegen
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codegen
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
  - Cristian Pereyra