schema_doctor 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
  SHA256:
3
- metadata.gz: 36282d15058adc20e4b9c2013bb9ddaa1d95f1e9457a10278be99a7b40c900e4
4
- data.tar.gz: baf1eae580dedd1d8cbe4c5ca5bfef36e08849589aec89856731a9680cfc268a
3
+ metadata.gz: da7654f58e8c8dff14e477cdf437a0c3532a2d650a299158eddda22d5ca2b794
4
+ data.tar.gz: 3a336c98c4420b1aa9f8b5d55ee99389aeeff4d893366eca32ad3e91e2ca18d5
5
5
  SHA512:
6
- metadata.gz: 917c1f0b805be6028f319f00698fdc153aedc38ffbf3b7ff6b780fc1d9eb4fd3fb7c0a106d4185cd32c54547279b509c869645a24ac3ca8849d2d5af6e4061a8
7
- data.tar.gz: b309be6513ad10e6bf0563c9da4c87d1c9b17507f87d1a670527cc6c73f0f1b41ce0dab22a5b5b395fa3a196df991f96415078c33aaad3677e1163c87a6bb5ec
6
+ metadata.gz: c7420bc7730dc74855950fefe32ca6352691ae2ee52f320556286f5ed8f5a6073fdcd75dec5d188d35a7f99759a493970a88d07fea01e2009552f5b067e6e084
7
+ data.tar.gz: 3d3fbe268ffc5cd71faca72598e70c3f35a1418cecdc835f5273c27c556448e1004ad555a1d8094eba0dedbdf9e0563c4de186a873d82e0d03088a60b084eccf
@@ -103,7 +103,7 @@ module SchemaDoctor
103
103
  name: association.name,
104
104
  class_name: association.class_name,
105
105
  foreign_key: association.foreign_key,
106
- options: association.options,
106
+ options: Utils.sefety_dump_hash(association.options),
107
107
  polymorphic: association.polymorphic?
108
108
  }
109
109
  when /\Ahas/
@@ -111,7 +111,7 @@ module SchemaDoctor
111
111
  macro: association.macro.to_s,
112
112
  name: association.name,
113
113
  class_name: association.class_name,
114
- options: association.options
114
+ options: Utils.sefety_dump_hash(association.options)
115
115
  }
116
116
  else
117
117
  puts "Unknown association type: #{association.macro}: :#{association.name}"
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SchemaDoctor
4
+ class Utils
5
+ class << self
6
+ def sefety_dump_hash(obj)
7
+ case obj
8
+ when Hash
9
+ obj.transform_values { |v| sefety_dump_hash(v) }
10
+ when Array
11
+ obj.map { |v| sefety_dump_hash(v) }
12
+ when TrueClass, FalseClass, NilClass, Integer, Float, String
13
+ obj
14
+ else
15
+ obj.to_s
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SchemaDoctor
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.4"
5
5
  end
data/lib/schema_doctor.rb CHANGED
@@ -4,6 +4,7 @@ require_relative "schema_doctor/version"
4
4
  require_relative "schema_doctor/schema_file"
5
5
  require_relative "schema_doctor/analyzer"
6
6
  require_relative "schema_doctor/exporter"
7
+ require_relative "schema_doctor/utils"
7
8
  require_relative "schema_doctor/railtie"
8
9
 
9
10
  module SchemaDoctor
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: schema_doctor
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
  - lni_T
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-04 00:00:00.000000000 Z
11
+ date: 2024-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -71,6 +71,7 @@ files:
71
71
  - lib/schema_doctor/railtie.rb
72
72
  - lib/schema_doctor/schema_file.rb
73
73
  - lib/schema_doctor/tasks/schemadoc.rake
74
+ - lib/schema_doctor/utils.rb
74
75
  - lib/schema_doctor/version.rb
75
76
  - sig/schema_doctor.rbs
76
77
  homepage: https://github.com/lnit/schema_doctor