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

Constructor Details

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

Returns a new instance of Vedeu::ApplicationView.

Parameters:

  • params (Hash)


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

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)


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

def params
  @params
end

Class Method Details

.render(**params) ⇒ void

This method returns an undefined value.

Renders the view.

Parameters:

  • params (Hash)


17
18
19
# File 'lib/vedeu/application/application_view.rb', line 17

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

Instance Method Details

#renderObject

Raises:

  • (Vedeu::Error::NotImplemented)

    When a subclass of the current class actually implements the method. Usually an indicator that the subclass should be used instead of the current class.



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

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)


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

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

#time_nowString Originally defined in module View

Returns the current local time.

Examples:

time_now # => Mon 29 Jun 19:26

Returns:

  • (String)