Class: RubyCritic::Serializer

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/serializer.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Serializer


6
7
8
# File 'lib/rubycritic/serializer.rb', line 6

def initialize(file)
  @file = file
end

Instance Method Details

#dump(content) ⇒ Object


14
15
16
17
18
19
# File 'lib/rubycritic/serializer.rb', line 14

def dump(content)
  create_file_directory
  File.open(@file, 'w+') do |file|
    Marshal.dump(content, file)
  end
end

#loadObject


10
11
12
# File 'lib/rubycritic/serializer.rb', line 10

def load
  Marshal.load(File.binread(@file))
end