lib/vedeu/interface/interfaces.rb in vedeu-0.0.9 vs lib/vedeu/interface/interfaces.rb in vedeu-0.0.10

- old
+ new

@@ -19,24 +19,32 @@ def list interfaces.inspect end - def add(name, options = {}, klass = Dummy) + def add(name, options = {}, klass = DummyInterface) interfaces[name] = klass.new(options) if valid?(klass) self end + def reset + @interfaces = {} + end + + def find(name) + interfaces[name] || nil + end + def initial_state interfaces.values.map { |io| io.initial_state } end def input interfaces.values.map { |io| io.input } end - def output(stream) - interfaces.values.map { |io| io.output(stream) } + def output + interfaces.values.map { |io| io.output } end private def valid?(klass)