Class: Flyer::ViewObject

Inherits:
Object
  • Object
show all
Defined in:
lib/flyer/view_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller, path, message, params, id) ⇒ ViewObject

Returns a new instance of ViewObject.



11
12
13
14
15
16
17
# File 'lib/flyer/view_object.rb', line 11

def initialize(controller, path, message, params, id)
  @controller = controller
  @path       = path
  @message    = message
  @params     = params
  @id         = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



2
3
4
# File 'lib/flyer/view_object.rb', line 2

def id
  @id
end

#paramsObject (readonly)

Returns the value of attribute params.



2
3
4
# File 'lib/flyer/view_object.rb', line 2

def params
  @params
end

Instance Method Details

#messageObject

Returns String.

Returns:

  • String



22
23
24
25
# File 'lib/flyer/view_object.rb', line 22

def message
  @controller.view_context.
    instance_eval(&@message).to_s.html_safe
end

#pathObject

Returns Path / String.

Returns:

  • Path / String

Raises:



30
31
32
33
# File 'lib/flyer/view_object.rb', line 30

def path
  raise Flyer::PathNotGivenError.new unless @path
  @controller.instance_eval(&@path)
end