Class: Viu::Html
- Inherits:
-
ActionView::Base
- Object
- ActionView::Base
- Viu::Html
show all
- Defined in:
- lib/viu/html.rb
Direct Known Subclasses
Layout
Defined Under Namespace
Modules: CompiledMethodContainer
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Html
Returns a new instance of Html.
8
|
# File 'lib/viu/html.rb', line 8
def initialize(*); end
|
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
32
33
34
|
# File 'lib/viu/html.rb', line 32
def controller
@controller
end
|
Class Method Details
.inherited(child) ⇒ Object
77
78
79
80
81
82
83
|
# File 'lib/viu/html.rb', line 77
def inherited(child)
child.include(Viu::Html::CompiledMethodContainer)
if defined?(Rails) && child != Viu::Layout
child.include(Rails.application.routes.url_helpers) unless child < Rails.application.routes.url_helpers
end
end
|
.layout ⇒ Object
89
90
91
|
# File 'lib/viu/html.rb', line 89
def layout
@__layout ||= nil
end
|
.layout!(value) ⇒ Object
85
86
87
|
# File 'lib/viu/html.rb', line 85
def layout!(value)
@__layout = value
end
|
.template ⇒ Object
97
98
99
|
# File 'lib/viu/html.rb', line 97
def template
@__template ||= nil
end
|
.template!(value) ⇒ Object
93
94
95
|
# File 'lib/viu/html.rb', line 93
def template!(value)
@__template = value
end
|
Instance Method Details
#compiled_method_container ⇒ Object
#render_in(view_context, options = EMPTY_HASH) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/viu/html.rb', line 16
def render_in(view_context, options = EMPTY_HASH)
__setup!(view_context)
return __render_template_proc if __fetch_template!.is_a?(Proc)
layout = options.fetch(:layout, self.class.layout)
if layout.is_a?(Class)
__render_layout_class(layout)
elsif layout.is_a?(Proc)
__render_layout_proc(layout)
else
@view_renderer.render(self, template: __fetch_template!, layout: layout)
end
end
|