class Molecule::File

Attributes

name[RW]

Public Class Methods

new(name) click to toggle source
# File lib/molecule/file.rb, line 8
def initialize name
  @name = name.to_s
end

Public Instance Methods

molecule_file_path() click to toggle source
# File lib/molecule/file.rb, line 22
def molecule_file_path
  Rails.root.join('app', 'molecules', @name, 'molecule.json').to_s
end
read() click to toggle source
# File lib/molecule/file.rb, line 12
def read
  JSON.parse(read_file, symbolize_names: true)
end
read_file() click to toggle source
# File lib/molecule/file.rb, line 16
def read_file
  ::File.read(molecule_file_path)
rescue
  '{}'
end