Class: DeployGate::Config::Base
- Inherits:
-
Object
- Object
- DeployGate::Config::Base
- Defined in:
- lib/deploygate/config/base.rb
Direct Known Subclasses
Class Method Summary collapse
Class Method Details
.exist? ⇒ Boolean
30 31 32 |
# File 'lib/deploygate/config/base.rb', line 30 def exist? File.exist?(file_path) end |
.file_path ⇒ Object
5 6 7 8 |
# File 'lib/deploygate/config/base.rb', line 5 def file_path # Please override this method raise NotImplementedError.new("You must implement #{self.class}##{__method__}") end |
.read ⇒ Hash
22 23 24 25 26 27 |
# File 'lib/deploygate/config/base.rb', line 22 def read file = File.open(file_path) data = file.read file.close JSON.parse(data) end |
.write(config) ⇒ void
This method returns an undefined value.
12 13 14 15 16 17 18 19 |
# File 'lib/deploygate/config/base.rb', line 12 def write(config) FileUtils.mkdir_p(File.dirname(file_path)) data = JSON.generate(config) file = File.open(file_path, "w+") file.print data file.close end |