Sha256: 182c8da6060dccd009f67dcaadad71d5c8d1e3cf5c3318a6e2f88127c6e7ec0e

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

require 'vedeu/output/presentation'

module Vedeu

  module Null

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

      include Vedeu::Presentation

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

      # @!attribute [r] attributes
      # @return [String]
      attr_reader :attributes

      # @!attribute [rw] visible
      # @return [String]
      attr_accessor :visible
      alias_method :visible?, :visible

      # Returns a new instance of Vedeu::Null::View.
      #
      # @param attributes [Hash<Symbol => void>]
      # @option attributes name [String]
      # @return [Vedeu::Null::View]
      def initialize(attributes = {})
        @attributes = attributes
        @name       = @attributes[:name]
        @visible    = @attributes[:visible]
      end

      # @return [NilClass]
      def null
        nil
      end
      alias_method :parent, :null
      alias_method :zindex, :null

      # @return [Boolean]
      def null?
        true
      end

      # Pretend to store this model in the repository.
      #
      # @return [Vedeu::Null::View]
      def store
        self
      end

      # The null interface should not be visible.
      #
      # @return [FalseClass]
      def visible?
        false
      end

    end # View

  end # Null

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.5.6 lib/vedeu/null/view.rb
vedeu-0.5.5 lib/vedeu/null/view.rb