Module: R2OAS::Schema::V3::FromFiles::DeepMethods
- Included in:
- Components::RequestBodyObject, Components::SchemaObject, PathItemObject
- Defined in:
- lib/r2-oas/schema/v3/object/from_files/utils/deep_methods.rb
Instance Method Summary collapse
Instance Method Details
#deep_replace!(data, target, &blk) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/r2-oas/schema/v3/object/from_files/utils/deep_methods.rb', line 8 def deep_replace!(data, target, &blk) return unless data.is_a?(Hash) data.each do |key, value| if key.eql? target # MEMO: # When using the same schema, it has already been replaced by an object if value.is_a?(String) data[key] = block_given? ? yield(value) : value end else deep_replace!(value, target, &blk) end end end |