Class: Gloo::Persist::FileStorage
- Inherits:
-
Object
- Object
- Gloo::Persist::FileStorage
- Defined in:
- lib/gloo/persist/file_storage.rb
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
-
#pn ⇒ Object
readonly
Returns the value of attribute pn.
Instance Method Summary collapse
-
#initialize(engine, pn, obj = nil) ⇒ FileStorage
constructor
Set up a file storage for an object.
-
#load ⇒ Object
Load the object from the file.
-
#save ⇒ Object
Save the object to the file.
Constructor Details
#initialize(engine, pn, obj = nil) ⇒ FileStorage
Set up a file storage for an object.
16 17 18 19 20 |
# File 'lib/gloo/persist/file_storage.rb', line 16 def initialize( engine, pn, obj = nil ) @engine = engine @obj = obj @pn = pn end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
11 12 13 |
# File 'lib/gloo/persist/file_storage.rb', line 11 def obj @obj end |
#pn ⇒ Object (readonly)
Returns the value of attribute pn.
11 12 13 |
# File 'lib/gloo/persist/file_storage.rb', line 11 def pn @pn end |
Instance Method Details
#load ⇒ Object
Load the object from the file.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gloo/persist/file_storage.rb', line 33 def load fl = FileLoader.new( @engine, @pn ) fl.load @obj = fl.obj if @obj @engine.log.debug "Loaded object: #{@obj.name}" else @engine.log.error "Error loading file at #{@pn}" end end |