summaryrefslogtreecommitdiffstats
path: root/lib/edoors
diff options
context:
space:
mode:
Diffstat (limited to 'lib/edoors')
-rw-r--r--lib/edoors/board.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/edoors/board.rb b/lib/edoors/board.rb
index f845dcd..990d312 100644
--- a/lib/edoors/board.rb
+++ b/lib/edoors/board.rb
@@ -25,11 +25,20 @@ module Edoors
#
class Board < Door
#
+ # creates a Board object from the arguments.
+ #
+ # @param [String] n the name of this Board
+ # @param [Iota] p the parent
+ #
def initialize n, p
super n, p
@postponed = {}
end
#
+ # called by JSON#generate to serialize the Board object into JSON data
+ #
+ # @param [Array] a belongs to JSON generator
+ #
def to_json *a
{
'kls' => self.class.name,
@@ -38,6 +47,12 @@ module Edoors
}.merge(hibernate!).to_json *a
end
#
+ # creates a Board object from a JSON data
+ #
+ # @param [Hash] o belongs to JSON parser
+ #
+ # @raise Edoors::Exception if the json kls attribute is wrong
+ #
def self.json_create o
raise Edoors::Exception.new "JSON #{o['kls']} != #{self.name}" if o['kls'] != self.name
board = self.new o['name'], o['parent']
@@ -48,6 +63,10 @@ module Edoors
board
end
#
+ # process the given particle then forward it to user code
+ #
+ # @param [Particle] p the Particle to be processed
+ #
def process_p p
@viewer.receive_p p if @viewer
if p.action!=Edoors::ACT_ERROR