Class: Rubycritic::Serializer
- Inherits:
-
Object
- Object
- Rubycritic::Serializer
- Defined in:
- lib/rubycritic/serializer.rb
Instance Method Summary collapse
- #dump(content) ⇒ Object
-
#initialize(file) ⇒ Serializer
constructor
A new instance of Serializer.
- #load ⇒ Object
Constructor Details
#initialize(file) ⇒ Serializer
Returns a new instance of Serializer.
5 6 7 |
# File 'lib/rubycritic/serializer.rb', line 5 def initialize(file) @file = file end |
Instance Method Details
#dump(content) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/rubycritic/serializer.rb', line 13 def dump(content) create_file_directory File.open(@file, 'w+') do |file| Marshal.dump(content, file) end end |
#load ⇒ Object
9 10 11 |
# File 'lib/rubycritic/serializer.rb', line 9 def load Marshal.load(File.binread(@file)) end |