class SolrMakr::LocalConfiguration::Settings

Public Instance Methods

make_backup!() click to toggle source

@return [void]

# File lib/solr_makr/local_configuration/settings.rb, line 23
def make_backup!
  return unless exists?

  backup_path = path.to_s.gsub(/\.toml$/, ".#{Time.now.utc.to_i}.toml")

  FileUtils.cp_r path.to_s, backup_path

  return nil
end
reparse!() click to toggle source

@return [ActiveSupport::HashWithIndifferentAccess]

# File lib/solr_makr/local_configuration/settings.rb, line 18
def reparse!
  self.parsed = parse_config_file
end
save!(new_data) click to toggle source

@param [Hash] new_data @return [void]

# File lib/solr_makr/local_configuration/settings.rb, line 35
def save!(new_data)
  create_local_directory_if_missing!
end

Private Instance Methods

parse_config_file() click to toggle source

@return [ActiveSupport::HashWithIndifferentAccess]

# File lib/solr_makr/local_configuration/settings.rb, line 41
def parse_config_file
  begin
    TOML.load_file path.to_s
  rescue Errno::ENOENT => e
    {}
  end.with_indifferent_access
end