lib/vedeu/models/view/interface.rb in vedeu-0.3.0 vs lib/vedeu/models/view/interface.rb in vedeu-0.3.1

- old
+ new

@@ -1,13 +1,13 @@ -require 'vedeu/support/common' require 'vedeu/support/content_geometry' require 'vedeu/models/model' require 'vedeu/presentation/presentation' require 'vedeu/buffers/display_buffer' require 'vedeu/buffers/buffer' require 'vedeu/models/view/lines' +require 'vedeu/models/view/line' module Vedeu # An Interface represents a portion of the terminal defined by # {Vedeu::Geometry}. It is a container for {Vedeu::Line} and {Vedeu::Stream} @@ -16,15 +16,17 @@ # @api private class Interface extend Forwardable - include Vedeu::Common include Vedeu::Model include Vedeu::Presentation include Vedeu::DisplayBuffer + collection Vedeu::Lines + member Vedeu::Line + attr_accessor :border, :colour, :delay, :geometry, :group, @@ -153,11 +155,11 @@ "<#{self.class.name} (lines:#{lines.size})>" end # @return [Vedeu::Lines] def lines - children.coerce(@lines, self) + collection.coerce(@lines, self) end alias_method :content, :lines alias_method :value, :lines # Returns a boolean indicating whether the interface has content. @@ -165,13 +167,15 @@ # @return [Boolean] def lines? lines.any? end - # @return [] + # Renders the interface with a border if one is defined. + # + # @return [Array] def render - if border + if border? border.render else viewport @@ -190,25 +194,9 @@ end # return [Array] def viewport Vedeu::Viewport.show(self) - end - - private - - # Return the class name for the children on this model. - # - # @return [Class] - def child - Vedeu::Line - end - - # Return the class name for the children on this model. - # - # @return [Class] - def children - Vedeu::Lines end end # Interface end # Vedeu