lib/vedeu/interface/interface.rb in vedeu-0.0.9 vs lib/vedeu/interface/interface.rb in vedeu-0.0.10
- old
+ new
@@ -2,22 +2,23 @@
class NotImplementedError < StandardError; end
class Interface
def initialize(options = {})
@options = options
+ @output = []
end
def initial_state
raise NotImplementedError, 'Subclasses implement this method.'
end
def input
- evaluate
+ raise Collapse if evaluate == :stop
end
- def output(command)
- Compositor.arrange(command, self)
+ def output
+ write
end
def geometry
@geometry ||= Geometry.new(options[:geometry])
end
@@ -25,14 +26,18 @@
private
attr_reader :options
def evaluate
- Commands.execute(read)
+ @output = Commands.execute(read)
end
def read
Terminal.input
+ end
+
+ def write
+ Compositor.arrange(@output, self)
end
def options
defaults.merge!(@options)
end