Sha256: 423e1a181679cbb07390aa47414702f892a5400cd7023c4f85b18060e1d3f583

Contents?: true

Size: 1.36 KB

Versions: 51

Compression:

Stored size: 1.36 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 (see #initialize)
    # @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

      @params.each do |key, value|
        self.class.send(:define_method, key) { value } unless respond_to?(key)
      end
    end

    # @raise [Vedeu::Error::NotImplemented] Subclasses of this class
    #   must implement this method.
    def render
      fail Vedeu::Error::NotImplemented,
           'The subclass of Vedeu::ApplicationView must implement the #render' \
           'method.'.freeze
    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]
    def template(value)
      @template = Vedeu::Configuration.base_path +
                  "/app/views/templates/#{value}.erb".freeze
    end

  end # ApplicationView

end # Vedeu

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
vedeu-0.8.0 lib/vedeu/application/application_view.rb
vedeu-0.7.4 lib/vedeu/application/application_view.rb
vedeu-0.7.3 lib/vedeu/application/application_view.rb
vedeu-0.7.2 lib/vedeu/application/application_view.rb
vedeu-0.7.1 lib/vedeu/application/application_view.rb
vedeu-0.7.0 lib/vedeu/application/application_view.rb
vedeu-0.6.71 lib/vedeu/application/application_view.rb
vedeu-0.6.70 lib/vedeu/application/application_view.rb
vedeu-0.6.69 lib/vedeu/application/application_view.rb
vedeu-0.6.68 lib/vedeu/application/application_view.rb
vedeu-0.6.67 lib/vedeu/application/application_view.rb
vedeu-0.6.66 lib/vedeu/application/application_view.rb
vedeu-0.6.65 lib/vedeu/application/application_view.rb
vedeu-0.6.64 lib/vedeu/application/application_view.rb
vedeu-0.6.63 lib/vedeu/application/application_view.rb
vedeu-0.6.62 lib/vedeu/application/application_view.rb
vedeu-0.6.61 lib/vedeu/application/application_view.rb
vedeu-0.6.60 lib/vedeu/application/application_view.rb
vedeu-0.6.59 lib/vedeu/application/application_view.rb
vedeu-0.6.58 lib/vedeu/application/application_view.rb