Class: Flyer::ViewObject
- Inherits:
-
Object
- Object
- Flyer::ViewObject
- Defined in:
- lib/flyer/view_object.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(controller, path, message, params, id) ⇒ ViewObject
constructor
A new instance of ViewObject.
-
#message ⇒ Object
String.
-
#path ⇒ Object
Path / String.
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, , params, id) @controller = controller @path = path @message = @params = params @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
2 3 4 |
# File 'lib/flyer/view_object.rb', line 2 def id @id end |
#params ⇒ Object (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
#message ⇒ Object
Returns String.
22 23 24 25 |
# File 'lib/flyer/view_object.rb', line 22 def @controller.view_context. instance_eval(&@message).to_s.html_safe end |
#path ⇒ Object
Returns Path / String.
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 |