Module: Cline::Serializable::File
- Included in:
- FileContent, Logs
- Defined in:
- lib/cline/serializable/file.rb
Overview
Add features to initialize from and save an object to a file.
Provides:
.open(file) -> [Object, nil]Provides a new instance initialized from the file, or nil if no file..monitor_file_changes(file, on_change)Provides a monitor to be notified on file changes..monitor_updates(file, on_change)Provides a monitor to be notified on new instances upon updates.#file -> [String]The file from which this object was initialized.
Defined Under Namespace
Modules: ClassMethods
Internal collapse
-
#file ⇒ String
readonly
The file used for the object's initialization.
Internal collapse
-
.included(base) ⇒ Object
Hook used when this mixin is included in a base class.
-
#initialize_from_file(file) ⇒ Object
Initialize this instance from a file.
Instance Attribute Details
#file ⇒ String (readonly)
Returns The file used for the object's initialization.
96 97 98 |
# File 'lib/cline/serializable/file.rb', line 96 def file @file end |
Class Method Details
.included(base) ⇒ Object
Hook used when this mixin is included in a base class
91 92 93 |
# File 'lib/cline/serializable/file.rb', line 91 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#initialize_from_file(file) ⇒ Object
Initialize this instance from a file
101 102 103 |
# File 'lib/cline/serializable/file.rb', line 101 def initialize_from_file(file) @file = file end |