summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-14 10:37:11 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-14 10:37:11 +0200
commit9534d0b4a8bb017278ef171ef35cbdcd3245e9c3 (patch)
tree40edf9fdb3261dbb26fb02c712c5c9cff7f2a2c5
parent20c597c6168f9cfecb1d7071b425c78c65b99349 (diff)
downloadedoors-ruby-9534d0b4a8bb017278ef171ef35cbdcd3245e9c3.zip
edoors-ruby-9534d0b4a8bb017278ef171ef35cbdcd3245e9c3.tar.gz
Door: to_json calls hibernate!, json_create calls resume!
-rw-r--r--lib/evendoors/door.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/evendoors/door.rb b/lib/evendoors/door.rb
index 5250ffe..bcf8534 100644
--- a/lib/evendoors/door.rb
+++ b/lib/evendoors/door.rb
@@ -32,12 +32,14 @@ module EvenDoors
{
'kls' => self.class.name,
'name' => @name
- }.to_json *a
+ }.merge(hibernate!).to_json *a
end
#
def self.json_create o
raise EvenDoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
- self.new o['name'], o['parent']
+ door = self.new o['name'], o['parent']
+ door.resume! o
+ door
end
#
def require_p p_kls