Sha256: e154cc883010635cffad7000ffaebbda62ddb8ae46cd1057438e9d09d4c3be68

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

require 'vedeu/output/presentation'

module Vedeu

  module Null

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

      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::Interface.
      #
      # @param attributes [Hash<Symbol => void>]
      # @option attributes name [String]
      # @return [Vedeu::Null::Interface]
      def initialize(attributes = {})
        @attributes = attributes
        @name       = @attributes[:name]
        @visible    = @attributes[:visible]
      end

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

      # @return [Boolean]
      def null?
        true
      end

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

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

    end # Interface

  end # Null

end # Vedeu

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.5.6 lib/vedeu/null/interface.rb
vedeu-0.5.5 lib/vedeu/null/interface.rb
vedeu-0.5.4 lib/vedeu/null/interface.rb