Class: Deveo::App::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/deveo/app.rb

Instance Method Summary collapse

Constructor Details

#initialize(app_path) ⇒ Metadata

Returns a new instance of Metadata.



44
45
46
# File 'lib/deveo/app.rb', line 44

def initialize(app_path)
  @app_path = app_path
end

Instance Method Details

#filenameObject



48
49
50
# File 'lib/deveo/app.rb', line 48

def filename
  File.join(@app_path, "app.json")
end

#readObject



52
53
54
# File 'lib/deveo/app.rb', line 52

def read
  JSON.parse(File.read(filename), symbolize_names: true)
end

#write(data = {}) ⇒ Object



56
57
58
59
60
61
# File 'lib/deveo/app.rb', line 56

def write(data = {})
  data = read.merge(data)
  File.open(filename, "w") do |file|
    file.write(JSON.pretty_generate(data))
  end
end