Class: Rubycritic::SmellyPathnamesSerializer

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

Instance Method Summary collapse

Constructor Details

#initialize(file_name) ⇒ SmellyPathnamesSerializer

Returns a new instance of SmellyPathnamesSerializer.



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

def initialize(file_name)
  @file_name = file_name
end

Instance Method Details

#dump(smelly_pathnames) ⇒ Object



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

def dump(smelly_pathnames)
  create_file_directory
  # HACK It's not possible to Marshal procs or lambdas.
  smelly_pathnames.default = []
  File.open(@file_name, "w+") do |file|
    Marshal.dump(smelly_pathnames, file)
  end
end

#loadObject



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

def load
  Marshal.load(File.read(@file_name))
end