class SublimePS::FilesManipulation::SublimePreferences

Public Class Methods

new() click to toggle source
# File lib/sublime_ps/files_manipulation/sublime_preferences.rb, line 5
def initialize
  @sublime_ps_preferences = SublimePSPreferences.new
end

Public Instance Methods

file_content() click to toggle source
# File lib/sublime_ps/files_manipulation/sublime_preferences.rb, line 9
def file_content
  JSON.parse(File.open(@sublime_ps_preferences.sublime_preferences_file_path).read)
end
set_content(content) click to toggle source
# File lib/sublime_ps/files_manipulation/sublime_preferences.rb, line 13
def set_content(content)
  remove_preference_file_content
  add_set_preference_file_content(content)
end

Private Instance Methods

add_set_preference_file_content(content_to_file) click to toggle source
# File lib/sublime_ps/files_manipulation/sublime_preferences.rb, line 26
def add_set_preference_file_content(content_to_file)
  output_file = File.open(@sublime_ps_preferences.sublime_preferences_file_path, 'w')
  output_file.puts(JSON.pretty_generate(content_to_file))
  output_file.close
end
remove_preference_file_content() click to toggle source
# File lib/sublime_ps/files_manipulation/sublime_preferences.rb, line 20
def remove_preference_file_content
  File.open(@sublime_ps_preferences.sublime_preferences_file_path, 'w') do |file|
    file.truncate(0)
  end
end