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)


23
24
25
26
27
28
29
# File 'lib/vedeu/application/application_view.rb', line 23

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)


43
44
45
# File 'lib/vedeu/application/application_view.rb', line 43

def params
  @params
end

Class Method Details

.render(**params) ⇒ void

This method returns an undefined value.

Renders the view.

Parameters:

  • params (Hash)


15
16
17
# File 'lib/vedeu/application/application_view.rb', line 15

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

Instance Method Details

#renderObject

Raises:



33
34
35
36
37
# File 'lib/vedeu/application/application_view.rb', line 33

def render
  fail Vedeu::Error::NotImplemented,
       'The subclass of Vedeu::ApplicationView must implement the #render' \
       'method.'
end

#template(value) ⇒ String (private)

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

Parameters:

  • value (String)

Returns:

  • (String)


52
53
54
55
# File 'lib/vedeu/application/application_view.rb', line 52

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