summaryrefslogtreecommitdiffstats
path: root/lib/evendoors/door.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/evendoors/door.rb')
-rw-r--r--lib/evendoors/door.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/evendoors/door.rb b/lib/evendoors/door.rb
index 7cff0b9..ba8bde6 100644
--- a/lib/evendoors/door.rb
+++ b/lib/evendoors/door.rb
@@ -12,6 +12,18 @@ module EvenDoors
@parent.add_spot self if @parent
end
#
+ def to_json *a
+ {
+ 'kls' => self.class.name,
+ 'name' => @name
+ }.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']
+ end
+ #
def require_p p_kls
p = EvenDoors::Spin.require_p p_kls
p.src = self