Class: JsonUpdater::UpdateService
- Inherits:
-
Object
- Object
- JsonUpdater::UpdateService
- Defined in:
- lib/json_updater.rb
Instance Attribute Summary collapse
-
#changeable_file_path ⇒ Object
readonly
Returns the value of attribute changeable_file_path.
-
#json_changeable ⇒ Object
readonly
Returns the value of attribute json_changeable.
-
#json_etalon ⇒ Object
readonly
Returns the value of attribute json_etalon.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(changeable_file_path:, etalon_file_path:) ⇒ UpdateService
constructor
A new instance of UpdateService.
- #update_json ⇒ Object
Constructor Details
#initialize(changeable_file_path:, etalon_file_path:) ⇒ UpdateService
Returns a new instance of UpdateService.
22 23 24 25 26 27 |
# File 'lib/json_updater.rb', line 22 def initialize(changeable_file_path:, etalon_file_path:) @changeable_file_path = changeable_file_path @json_changeable = JSON.parse(File.open(changeable_file_path).read) @json_etalon = JSON.parse(File.open(etalon_file_path).read) end |
Instance Attribute Details
#changeable_file_path ⇒ Object (readonly)
Returns the value of attribute changeable_file_path.
16 17 18 |
# File 'lib/json_updater.rb', line 16 def changeable_file_path @changeable_file_path end |
#json_changeable ⇒ Object (readonly)
Returns the value of attribute json_changeable.
16 17 18 |
# File 'lib/json_updater.rb', line 16 def json_changeable @json_changeable end |
#json_etalon ⇒ Object (readonly)
Returns the value of attribute json_etalon.
16 17 18 |
# File 'lib/json_updater.rb', line 16 def json_etalon @json_etalon end |
Class Method Details
.update_json(changeable_file_path:, etalon_file_path:) ⇒ Object
18 19 20 |
# File 'lib/json_updater.rb', line 18 def self.update_json(changeable_file_path:, etalon_file_path:) new(changeable_file_path: changeable_file_path, etalon_file_path: etalon_file_path).update_json end |
Instance Method Details
#update_json ⇒ Object
29 30 31 |
# File 'lib/json_updater.rb', line 29 def update_json rewrite_file end |