Sha256: 5e401b60afe7d98c6603c31367f29445b637eec666372651b6f5a1539752f477

Contents?: true

Size: 1.65 KB

Versions: 8

Compression:

Stored size: 1.65 KB

Contents

module Vedeu

  module Null

    # Provides a non-existent model to swallow messages.
    class Geometry

      extend Forwardable

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

      # @!attribute [rw] maximise
      # @return [Boolean]
      attr_accessor :maximised

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

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

      # @return [FalseClass]
      def centred
        false
      end

      # @return [FalseClass]
      def maximise
        false
      end

      # @return [Vedeu::Null::Geometry]
      def store
        self
      end

      # @return [FalseClass]
      def unmaximise
        false
      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 # Geometry

  end # Null

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.4.29 lib/vedeu/null/geometry.rb
vedeu-0.4.28 lib/vedeu/null/geometry.rb
vedeu-0.4.27 lib/vedeu/null/geometry.rb
vedeu-0.4.26 lib/vedeu/null/geometry.rb
vedeu-0.4.25 lib/vedeu/null/geometry.rb
vedeu-0.4.24 lib/vedeu/null/geometry.rb
vedeu-0.4.23 lib/vedeu/null/geometry.rb
vedeu-0.4.22 lib/vedeu/null/geometry.rb