Sha256: bed133a3e804ddc233e05c7dd2d6fb59e750e781e79fa3e65529a2ae44cbc93a

Contents?: true

Size: 1.24 KB

Versions: 2

Compression:

Stored size: 1.24 KB

Contents

require 'vedeu/output/presentation'

module Vedeu

  module Null

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

      include Vedeu::Presentation

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

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

      # @return [Hash<Symbol => String>]
      def attributes
        {
          name: name,
        }
      end

      # @return [Boolean]
      def null?
        true
      end

      # The null interface should not have a parent.
      #
      # @return [NilClass]
      def parent
        nil
      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

      # Override the visible= setter usually found on a Vedeu::Interface.
      #
      # @return [FalseClass]
      def visible=(*)
        false
      end

    end # Interface

  end # Null

end # Vedeu

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.4.53 lib/vedeu/null/interface.rb
vedeu-0.4.52 lib/vedeu/null/interface.rb