Sha256: 247fd1442b3f03012d7789a294ccd8695fe3b84d59a48217047afb73463ad534

Contents?: true

Size: 1.75 KB

Versions: 16

Compression:

Stored size: 1.75 KB

Contents

module Vedeu

  module Geometry

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

      extend Forwardable

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

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

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

      # Returns a new instance of Vedeu::Geometry::Null.
      #
      # @param attributes [Hash<Symbol => void>]
      # @option attributes name [String|NilClass]
      # @return [Vedeu::Geometry::Null]
      def initialize(attributes = {})
        @attributes = attributes
        @name       = @attributes[:name]
        @maximised  = @attributes.fetch(:maximised, false)
      end

      # @return [FalseClass]
      def centred
        false
      end

      # @return [FalseClass]
      def maximised?
        false
      end
      alias_method :maximise, :maximised?
      alias_method :unmaximise, :maximised?

      # @return [Boolean]
      def null?
        true
      end

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

      private

      # @return [Vedeu::Geometry::Area]
      def area
        @area ||= Vedeu::Geometry::Area.from_attributes(y_default: Vedeu.height,
                                                        x_default: Vedeu.width)
      end

    end # Null

  end # Geometry

end # Vedeu

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
vedeu-0.6.20 lib/vedeu/geometry/null.rb
vedeu-0.6.19 lib/vedeu/geometry/null.rb
vedeu-0.6.18 lib/vedeu/geometry/null.rb
vedeu-0.6.17 lib/vedeu/geometry/null.rb
vedeu-0.6.16 lib/vedeu/geometry/null.rb
vedeu-0.6.15 lib/vedeu/geometry/null.rb
vedeu-0.6.14 lib/vedeu/geometry/null.rb
vedeu-0.6.13 lib/vedeu/geometry/null.rb
vedeu-0.6.12 lib/vedeu/geometry/null.rb
vedeu-0.6.11 lib/vedeu/geometry/null.rb
vedeu-0.6.10 lib/vedeu/geometry/null.rb
vedeu-0.6.9 lib/vedeu/geometry/null.rb
vedeu-0.6.8 lib/vedeu/geometry/null.rb
vedeu-0.6.7 lib/vedeu/geometry/null.rb
vedeu-0.6.6 lib/vedeu/geometry/null.rb
vedeu-0.6.5 lib/vedeu/geometry/null.rb