Class: SchemaDoctor::Utils
- Inherits:
-
Object
- Object
- SchemaDoctor::Utils
- Defined in:
- lib/schema_doctor/utils.rb
Class Method Summary collapse
Class Method Details
.deep_stringify(obj) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/schema_doctor/utils.rb', line 19 def deep_stringify(obj) case obj when Hash obj.transform_keys(&:to_s).transform_values { |v| deep_stringify(v) } when Array obj.map { |v| deep_stringify(v) } else obj end end |
.safety_dump_hash(obj) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/schema_doctor/utils.rb', line 6 def safety_dump_hash(obj) case obj when Hash obj.transform_values { |v| safety_dump_hash(v) } when Array obj.map { |v| safety_dump_hash(v) } when TrueClass, FalseClass, NilClass, Integer, Float, String obj else obj.to_s end end |