Sha256: 7e2a690d865d5f8f04d6e79745e6f8301f838edd242676087970697a6c51639c

Contents?: true

Size: 1.23 KB

Versions: 8

Compression:

Stored size: 1.23 KB

Contents

module Vedeu

  # Provides the mechanism to render views for the client application. The
  # client application's ApplicationView will inherit from this class.
  #
  class ApplicationView

    include Vedeu::View

    # Renders the view.
    #
    # @param params [Hash]
    # @return [void]
    def self.render(**params)
      new(params).render
    end

    # Returns a new instance of Vedeu::ApplicationView.
    #
    # @param params [Hash]
    # @return [Vedeu::ApplicationView]
    def initialize(**params)
      @params = params
    end

    # @raise [Vedeu::NotImplemented] Subclasses of this class must implement
    #   this method.
    def render
      fail Vedeu::NotImplemented,
           'The subclass of Vedeu::ApplicationView must implement the #render' \
           'method.'
    end

    protected

    # @!attribute [rw] params
    # @return [Hash]
    attr_accessor :params

    private

    # Provides the path to the template file using the base_path configuration
    # option.
    #
    # @param value [String]
    # @return [String]
    # :nocov:
    def template(value)
      @template = Vedeu::Configuration.base_path +
                  "/app/views/templates/#{value}.erb"
    end
    # :nocov:

  end # ApplicationView

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.5.11 lib/vedeu/application/application_view.rb
vedeu-0.5.10 lib/vedeu/application/application_view.rb
vedeu-0.5.9 lib/vedeu/application/application_view.rb
vedeu-0.5.8 lib/vedeu/application/application_view.rb
vedeu-0.5.7 lib/vedeu/application/application_view.rb
vedeu-0.5.6 lib/vedeu/application/application_view.rb
vedeu-0.5.5 lib/vedeu/application/application_view.rb
vedeu-0.5.4 lib/vedeu/application/application_view.rb