Class: Chatwerk::Views::BaseView
- Inherits:
-
Object
- Object
- Chatwerk::Views::BaseView
- Defined in:
- lib/chatwerk/views/base_view.rb
Direct Known Subclasses
NoPackagesView, NoViolationsView, PackageView, PackagesView, ViolationsDetailsView, ViolationsListView
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**data) ⇒ BaseView
constructor
A new instance of BaseView.
- #render ⇒ Object
Constructor Details
#initialize(**data) ⇒ BaseView
Returns a new instance of BaseView.
12 13 14 15 |
# File 'lib/chatwerk/views/base_view.rb', line 12 def initialize(**data) @data = data @output = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, **kwargs, &block) ⇒ Object (private)
36 37 38 |
# File 'lib/chatwerk/views/base_view.rb', line 36 def method_missing(name, *args, **kwargs, &block) @data[name] end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
10 11 12 |
# File 'lib/chatwerk/views/base_view.rb', line 10 def data @data end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
10 11 12 |
# File 'lib/chatwerk/views/base_view.rb', line 10 def output @output end |
Class Method Details
.render(**data) ⇒ Object
6 7 8 |
# File 'lib/chatwerk/views/base_view.rb', line 6 def self.render(**data) new(**data).render end |
Instance Method Details
#render ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/chatwerk/views/base_view.rb', line 17 def render @output = nil temp = template(**data) return temp if @output.nil? # allow templates to return a string instead @output end |