Class: PositronicBrain::Persistence::Base
- Inherits:
-
Object
- Object
- PositronicBrain::Persistence::Base
- Defined in:
- lib/positronic_brain/persistence/persistence.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#dump_path ⇒ Object
readonly
Returns the value of attribute dump_path.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#persistence ⇒ Object
readonly
Returns the value of attribute persistence.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #dump ⇒ Object
-
#initialize(dump_path, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(dump_path, options = {}) ⇒ Base
Returns a new instance of Base.
8 9 10 11 |
# File 'lib/positronic_brain/persistence/persistence.rb', line 8 def initialize(dump_path, = {}) @dump_path, @options = dump_path, load || init end |
Instance Attribute Details
#dump_path ⇒ Object (readonly)
Returns the value of attribute dump_path.
6 7 8 |
# File 'lib/positronic_brain/persistence/persistence.rb', line 6 def dump_path @dump_path end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/positronic_brain/persistence/persistence.rb', line 6 def @options end |
#persistence ⇒ Object (readonly)
Returns the value of attribute persistence.
6 7 8 |
# File 'lib/positronic_brain/persistence/persistence.rb', line 6 def persistence @persistence end |
Instance Method Details
#==(other) ⇒ Object
18 19 20 |
# File 'lib/positronic_brain/persistence/persistence.rb', line 18 def ==(other) @persistence == other.persistence end |
#dump ⇒ Object
13 14 15 16 |
# File 'lib/positronic_brain/persistence/persistence.rb', line 13 def dump ensure_dump_directory File.open(@dump_path, 'w'){ |f| f.puts Marshal.dump @persistence } end |