Class: Convoy::Setup::Configuration::Writer
- Inherits:
-
Object
- Object
- Convoy::Setup::Configuration::Writer
- Defined in:
- lib/convoy/setup/configuration/writer.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, data) ⇒ Writer
constructor
A new instance of Writer.
- #update ⇒ Object
- #write ⇒ Object
Constructor Details
#initialize(path, data) ⇒ Writer
Returns a new instance of Writer.
10 11 12 13 |
# File 'lib/convoy/setup/configuration/writer.rb', line 10 def initialize(path, data) @path = path @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
8 9 10 |
# File 'lib/convoy/setup/configuration/writer.rb', line 8 def data @data end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/convoy/setup/configuration/writer.rb', line 8 def path @path end |
Instance Method Details
#update ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/convoy/setup/configuration/writer.rb', line 24 def update current_data = {} if File.exists? path current_data = Reader.new(path).read.data end @data = Convoy::Setup::Configuration::MergeTool.new(data, current_data).config_hash save_to_file Instance.new(path, data) end |