Module: Flutterby::Layout
Class Method Summary collapse
-
.apply!(body, view:) ⇒ Object
Determines which layouts should be applied to the view object (based on the node it is rendering), and then applies each of these layouts in order, modifying the view in place.
Instance Method Summary collapse
-
#apply!(body, view:) ⇒ Object
Determines which layouts should be applied to the view object (based on the node it is rendering), and then applies each of these layouts in order, modifying the view in place.
Class Method Details
.apply!(body, view:) ⇒ Object
Determines which layouts should be applied to the view object (based on the node it is rendering), and then applies each of these layouts in order, modifying the view in place.
9 10 11 12 13 14 |
# File 'lib/flutterby/layout.rb', line 9 def apply!(body, view:) collect_layouts(view).inject(body) do |acc, layout| tilt = Flutterby::Filters.tilt(layout.ext, layout.source) tilt.render(view) { acc }.html_safe end end |
Instance Method Details
#apply!(body, view:) ⇒ Object
Determines which layouts should be applied to the view object (based on the node it is rendering), and then applies each of these layouts in order, modifying the view in place.
9 10 11 12 13 14 |
# File 'lib/flutterby/layout.rb', line 9 def apply!(body, view:) collect_layouts(view).inject(body) do |acc, layout| tilt = Flutterby::Filters.tilt(layout.ext, layout.source) tilt.render(view) { acc }.html_safe end end |