Sha256: 20b755950c3fb457f6327c5f940a90817471144150861fa1591c22d2933ce49e

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

module Vedeu

  # Provides geometry for interfaces that do not have geometry defined.
  #
  class NullGeometry

    extend Forwardable

    def_delegators :area,
                   :north,
                   :east,
                   :south,
                   :west,
                   :top,
                   :right,
                   :bottom,
                   :left,
                   :y,
                   :xn,
                   :yn,
                   :x,
                   :height,
                   :width,
                   :top_left,
                   :top_right,
                   :bottom_left,
                   :bottom_right

    # @return [Vedeu::NullGeometry]
    def initialize; end

    # @return [FalseClass]
    def centred
      false
    end

    # @return [Vedeu::NullGeometry]
    def store
      self
    end

    private

    # @return [Vedeu::Area]
    def area
      @area ||= Vedeu::Area.from_dimensions(y_yn: y_yn, x_xn: x_xn)
    end

    # @return [Array<Fixnum>]
    def x_xn
      @x_xn ||= Vedeu::Dimension.pair(default: Vedeu::Terminal.width)
    end

    # @return [Array<Fixnum>]
    def y_yn
      @y_yn ||= Vedeu::Dimension.pair(default: Vedeu::Terminal.height)
    end

  end # NullGeometry

end # Vedeu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.4.14 lib/vedeu/geometry/null_geometry.rb