lib/vedeu/interface/interfaces.rb in vedeu-0.0.7 vs lib/vedeu/interface/interfaces.rb in vedeu-0.0.8
- old
+ new
@@ -1,34 +1,35 @@
module Vedeu
class UndefinedInterface < StandardError; end
module Interfaces
extend self
+ attr_accessor :interfaces
- def default
- add(:dummy, Dummy)
- end
-
- def defined
- interfaces.empty? ? nil : interfaces
- end
-
def define(&block)
if block_given?
yield self
else
self
end
end
+ def defined
+ interfaces.empty? ? nil : self
+ end
+
+ def default
+ add(:dummy, Dummy)
+ end
+
def list
interfaces.inspect
end
def add(name, klass, options = {})
if valid?(klass)
interfaces[name] = Proc.new { klass.new(options) }
- interfaces
+ self
end
end
def initial_state
interfaces.values.map { |io| io.call.initial_state }