Class: FileMarshal::Dumper
- Inherits:
-
Object
- Object
- FileMarshal::Dumper
- Defined in:
- lib/file_marshal/dumper.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(file) ⇒ Dumper
constructor
A new instance of Dumper.
- #to_hash ⇒ Object
Constructor Details
#initialize(file) ⇒ Dumper
Returns a new instance of Dumper.
5 6 7 |
# File 'lib/file_marshal/dumper.rb', line 5 def initialize(file) @file = file end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
3 4 5 |
# File 'lib/file_marshal/dumper.rb', line 3 def file @file end |
Instance Method Details
#content ⇒ Object
17 18 19 20 |
# File 'lib/file_marshal/dumper.rb', line 17 def content file.rewind file.read end |
#to_hash ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/file_marshal/dumper.rb', line 9 def to_hash { updated_at: file.mtime, name: File.basename(file.path), content: content } end |