diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-18 09:47:20 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2012-06-18 09:50:55 +0200 |
commit | 394ec7f39a83df5edd3eef6667b16698ed689407 (patch) | |
tree | 791fef9cee7b3bf13fa6ccfc9d1af1e445e5a37a /lib | |
parent | 81311b79a8efa3705c94b2fa3af0186a1a0776d9 (diff) | |
download | edoors-ruby-394ec7f39a83df5edd3eef6667b16698ed689407.zip edoors-ruby-394ec7f39a83df5edd3eef6667b16698ed689407.tar.gz |
implement SYS_ACT_ADD_ROOM
Diffstat (limited to 'lib')
-rw-r--r-- | lib/edoors.rb | 1 | ||||
-rw-r--r-- | lib/edoors/iota.rb | 2 | ||||
-rw-r--r-- | lib/edoors/room.rb | 6 |
3 files changed, 9 insertions, 0 deletions
diff --git a/lib/edoors.rb b/lib/edoors.rb index 76b47bd..d70d5bf 100644 --- a/lib/edoors.rb +++ b/lib/edoors.rb @@ -31,6 +31,7 @@ module Edoors # SYS_ACT_HIBERNATE = 'hibernate'.freeze SYS_ACT_ADD_LINK = 'sys_add_link'.freeze + SYS_ACT_ADD_ROOM = 'sys_add_room'.freeze # FIELD_ERROR_MSG = 'edoors_error'.freeze FIELD_HIBERNATE_PATH = 'hibernate_path'.freeze diff --git a/lib/edoors/iota.rb b/lib/edoors/iota.rb index 47a2eb6..fcf7573 100644 --- a/lib/edoors/iota.rb +++ b/lib/edoors/iota.rb @@ -21,6 +21,8 @@ # module Edoors # + IOTA_NAME = 'edoors_iota_name'.freeze + # class Iota # def initialize n, p diff --git a/lib/edoors/room.rb b/lib/edoors/room.rb index 1c855c1..5936e27 100644 --- a/lib/edoors/room.rb +++ b/lib/edoors/room.rb @@ -58,6 +58,10 @@ module Edoors room end # + def self.from_particle_data p, s + Edoors::Room.new(p.get_data(Edoors::IOTA_NAME), s) + end + # def add_iota s raise Edoors::Exception.new "Iota #{s.name} already has #{s.parent.name} as parent" if not s.parent.nil? and s.parent!=self raise Edoors::Exception.new "Iota #{s.name} already exists in #{path}" if @iotas.has_key? s.name @@ -179,6 +183,8 @@ module Edoors def process_sys_p p if p.action==Edoors::SYS_ACT_ADD_LINK add_link Edoors::Link.from_particle_data p + elsif p.action==Edoors::SYS_ACT_ADD_ROOM + Edoors::Room.from_particle_data p, self end @spin.release_p p end |