summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-13 00:46:31 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-13 00:46:31 +0200
commita2496f647ff0f2532fb8ee4a0c02c80e7aa2a2cb (patch)
treea48d21b0d42961a92fa3846eb44c4f8117d853de
parentba108de1be22fbcbf5d34bab4aec337120bba60d (diff)
downloadedoors-ruby-a2496f647ff0f2532fb8ee4a0c02c80e7aa2a2cb.zip
edoors-ruby-a2496f647ff0f2532fb8ee4a0c02c80e7aa2a2cb.tar.gz
Spin: a few hibernate related adjustments
-rw-r--r--lib/evendoors/spin.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/evendoors/spin.rb b/lib/evendoors/spin.rb
index 88af3bc..a5795b7 100644
--- a/lib/evendoors/spin.rb
+++ b/lib/evendoors/spin.rb
@@ -48,7 +48,7 @@ module EvenDoors
end
end
#
- attr_accessor :run, :debug_errors, :debug_routing
+ attr_accessor :run, :hibernate_path, :debug_errors, :debug_routing
#
def to_json *a
{
@@ -103,6 +103,7 @@ module EvenDoors
#
def process_sys_p p
if p.action==EvenDoors::SYS_ACT_HIBERNATE
+ stop!
hibernate! p[FIELD_HIBERNATE_PATH]
else
super p
@@ -131,12 +132,11 @@ module EvenDoors
end
#
def hibernate! path=nil
- stop!
File.open(path||@hibernate_path,'w') do |f| f << JSON.pretty_generate(self) end
end
#
- def self.resume! path=nil
- self.json_create JSON.load File.open(path||@hibernate_path,'r') { |f| f.read }
+ def self.resume! path
+ self.json_create JSON.load File.open(path,'r') { |f| f.read }
end
#
end