Class: Vedeu::ApplicationView

Inherits:
Object
  • Object
show all
Includes:
View
Defined in:
lib/vedeu/application/application_view.rb

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from View

#time_now

Constructor Details

#initialize(**params) ⇒ Vedeu::ApplicationView

Returns a new instance of Vedeu::ApplicationView.

Parameters:

  • params (Hash)


27
28
29
30
31
32
33
# File 'lib/vedeu/application/application_view.rb', line 27

def initialize(**params)
  @params = params

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

Instance Attribute Details

#paramsHash (protected)

Returns:

  • (Hash)


46
47
48
# File 'lib/vedeu/application/application_view.rb', line 46

def params
  @params
end

Class Method Details

.render(**params) ⇒ void

This method returns an undefined value.

Renders the view.

Parameters:

  • params (Hash)


19
20
21
# File 'lib/vedeu/application/application_view.rb', line 19

def self.render(**params)
  new(params).render
end

Instance Method Details

#renderObject

Note:

Client applications should implement this method.

Raises:

  • (Vedeu::Error::NotImplemented)

    When the method called should be handled by a subclass of the current class, or by the class including or extending the current module.



38
39
40
# File 'lib/vedeu/application/application_view.rb', line 38

def render
  raise Vedeu::Error::NotImplemented
end

#template(value) ⇒ String (private)

Provides the path to the template file using the base_path configuration option.

Parameters:

  • value (String)

Returns:

  • (String)


55
56
57
58
# File 'lib/vedeu/application/application_view.rb', line 55

def template(value)
  @template = Vedeu.config.base_path +
              "/app/views/templates/#{value}.erb"
end