Sha256: a67e0317ad34afeed76f3d6e87d6a4cf6386f3b5f737ad196ef9e42551d5073f

Contents?: true

Size: 1.48 KB

Versions: 28

Compression:

Stored size: 1.48 KB

Contents

module Vedeu

  module Borders

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

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

      # Returns a new instance of Vedeu::Borders::Null.
      #
      # @param attributes [Hash<Symbol => void>]
      # @option attributes name [String|Symbol|NilClass]
      # @return [Vedeu::Borders::Null]
      def initialize(attributes = {})
        @attributes = attributes
        @name       = @attributes[: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

      # @return [Boolean]
      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::Geometry::Repository#by_name)
      def geometry
        @geometry ||= Vedeu.geometries.by_name(name)
      end

    end # Null

  end # Borders

end # Vedeu

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
vedeu-0.6.50 lib/vedeu/borders/null.rb
vedeu-0.6.49 lib/vedeu/borders/null.rb
vedeu-0.6.48 lib/vedeu/borders/null.rb
vedeu-0.6.47 lib/vedeu/borders/null.rb
vedeu-0.6.46 lib/vedeu/borders/null.rb
vedeu-0.6.45 lib/vedeu/borders/null.rb
vedeu-0.6.44 lib/vedeu/borders/null.rb
vedeu-0.6.43 lib/vedeu/borders/null.rb
vedeu-0.6.42 lib/vedeu/borders/null.rb
vedeu-0.6.41 lib/vedeu/borders/null.rb
vedeu-0.6.40 lib/vedeu/borders/null.rb
vedeu-0.6.39 lib/vedeu/borders/null.rb
vedeu-0.6.38 lib/vedeu/borders/null.rb
vedeu-0.6.37 lib/vedeu/borders/null.rb
vedeu-0.6.36 lib/vedeu/borders/null.rb
vedeu-0.6.35 lib/vedeu/borders/null.rb
vedeu-0.6.34 lib/vedeu/borders/null.rb
vedeu-0.6.33 lib/vedeu/borders/null.rb
vedeu-0.6.32 lib/vedeu/borders/null.rb
vedeu-0.6.31 lib/vedeu/borders/null.rb