Module: Flutterby::Layout

Extended by:
Layout
Included in:
Layout
Defined in:
lib/flutterby/layout.rb

Class Method Summary collapse

Instance Method Summary collapse

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