Sha256: 3aef7d7b3692a943b0fce8601a393c980d0683d612ca40bcf1c67c604c5ff31c
Contents?: true
Size: 962 Bytes
Versions: 1
Compression:
Stored size: 962 Bytes
Contents
module Vedeu class UndefinedInterface < StandardError; end module Interfaces extend self attr_accessor :interfaces def define(&block) if block_given? yield self else self end end def defined interfaces.empty? ? default : self end def list interfaces.inspect end def add(name, options = {}, klass = Dummy) interfaces[name] = klass.new(options) if valid?(klass) self 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) } end private def valid?(klass) raise UndefinedInterface unless Object.const_defined?(klass.to_s) true end def default add(:dummy) self end def interfaces @interfaces ||= {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.9 | lib/vedeu/interface/interfaces.rb |