class RubyCritic::Serializer

Public Class Methods

new(file) click to toggle source
# File lib/rubycritic/serializer.rb, line 7
def initialize(file)
  @file = file
end

Public Instance Methods

dump(content) click to toggle source
# File lib/rubycritic/serializer.rb, line 15
def dump(content)
  create_file_directory
  File.open(@file, 'w+') do |file|
    Marshal.dump(content, file)
  end
end
load() click to toggle source
# File lib/rubycritic/serializer.rb, line 11
def load
  Marshal.load(File.binread(@file))
end

Private Instance Methods

create_file_directory() click to toggle source
# File lib/rubycritic/serializer.rb, line 24
def create_file_directory
  FileUtils.mkdir_p(file_directory)
end
file_directory() click to toggle source
# File lib/rubycritic/serializer.rb, line 28
def file_directory
  File.dirname(@file)
end