class JsonUpdater::JsonStructureUpdater
Attributes
json_changeable[R]
json_etalon[R]
Public Class Methods
new(json_changeable:, json_etalon:)
click to toggle source
# File lib/json_updater/json_structure_updater.rb, line 11 def initialize(json_changeable:, json_etalon:) @json_changeable = json_changeable @json_etalon = json_etalon.dup end
update_json(json_changeable:, json_etalon:)
click to toggle source
# File lib/json_updater/json_structure_updater.rb, line 7 def self.update_json(json_changeable:, json_etalon:) new(json_changeable: json_changeable, json_etalon: json_etalon).update_json end
Public Instance Methods
update_json()
click to toggle source
# File lib/json_updater/json_structure_updater.rb, line 16 def update_json update_json_keys end
Private Instance Methods
update_json_keys()
click to toggle source
# File lib/json_updater/json_structure_updater.rb, line 22 def update_json_keys json_etalon.each do |key, _value| json_etalon[key] = json_changeable[key] if json_changeable.key?(key) end end