How are erg models implemented?

How are Rails ERB layouts implemented? I tried to look at the source, but I could not determine where and how they work.

I am particularly interested in how yield works , how erb includes a visual representation in a template.

The reason I need it is because I can use it to generate non-Rails non-HTML code (and because it would be interesting to know how they work)

+5
source share
1 answer

Rails displays inside out, so it first displays show.html.erb and stores it in a variable. Then it will display the layout

inside the layout you see

<%= yield %>

shot.html.erb

. :

<% content_for(:footer) do %>
  ...
<% end %>

:

<%= yield(:footer) %>

, .

+3