Sha256: effe728d7649164b1d680669e600c301cb3466bb1f5717a4e59ffa553ee8bfc6

Contents?: true

Size: 1.44 KB

Versions: 14

Compression:

Stored size: 1.44 KB

Contents

module Vedeu

  module Null

    # Provides a non-existent Vedeu::Border that acts like the real thing, but
    # does nothing.
    class Border

      # @!attribute [r] name
      # @return [String|NilClass]
      attr_reader :name

      # Returns a new instance of Vedeu::Null::Border.
      #
      # @param name [String|NilClass]
      # @return [Vedeu::Null::Border]
      def initialize(name = nil)
        @name = name
      end

      # @return [Fixnum]
      def bx
        geometry.x
      end
      alias_method :x, :bx

      # @return [Fixnum]
      def bxn
        geometry.xn
      end
      alias_method :xn, :bxn

      # @return [Fixnum]
      def by
        geometry.y
      end
      alias_method :y, :by

      # @return [Fixnum]
      def byn
        geometry.yn
      end
      alias_method :yn, :byn

      # The null border should not be enabled, so that named geometry
      # or null geometry is used.
      #
      # @return [FalseClass]
      def enabled?
        false
      end

      # @return [Fixnum]
      def height
        (by..byn).size
      end

      # @return [Array]
      def render
        []
      end

      # @return [Fixnum]
      def width
        (bx..bxn).size
      end

      private

      # Returns the geometry for the interface.
      #
      # @return (see Vedeu::Geometries#by_name)
      def geometry
        @geometry ||= Vedeu.geometries.by_name(name)
      end

    end # Border

  end # Null

end # Vedeu

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vedeu-0.4.32 lib/vedeu/null/border.rb
vedeu-0.4.31 lib/vedeu/null/border.rb
vedeu-0.4.30 lib/vedeu/null/border.rb
vedeu-0.4.29 lib/vedeu/null/border.rb
vedeu-0.4.28 lib/vedeu/null/border.rb
vedeu-0.4.27 lib/vedeu/null/border.rb
vedeu-0.4.26 lib/vedeu/null/border.rb
vedeu-0.4.25 lib/vedeu/null/border.rb
vedeu-0.4.24 lib/vedeu/null/border.rb
vedeu-0.4.23 lib/vedeu/null/border.rb
vedeu-0.4.22 lib/vedeu/null/border.rb
vedeu-0.4.21 lib/vedeu/null/border.rb
vedeu-0.4.20 lib/vedeu/null/border.rb
vedeu-0.4.19 lib/vedeu/null/border.rb