Class: Rambling::Trie::Serializers::File
- Inherits:
-
Object
- Object
- Rambling::Trie::Serializers::File
- Defined in:
- lib/rambling/trie/serializers/file.rb
Overview
Basic file serializer. Dumps/loads string contents from files.
Instance Method Summary collapse
-
#dump(contents, filepath) ⇒ Numeric
Dumps contents into a specified filepath.
-
#load(filepath) ⇒ String
Loads contents from a specified filepath.
Instance Method Details
#dump(contents, filepath) ⇒ Numeric
Dumps contents into a specified filepath.
19 20 21 22 23 |
# File 'lib/rambling/trie/serializers/file.rb', line 19 def dump contents, filepath ::File.open filepath, 'w+' do |f| f.write contents end end |
#load(filepath) ⇒ String
Loads contents from a specified filepath.
11 12 13 |
# File 'lib/rambling/trie/serializers/file.rb', line 11 def load filepath ::File.read filepath end |