Where is Ruby's ERB format “officially” defined?

后端 未结 1 1761
抹茶落季
抹茶落季 2021-02-13 14:09

A number of sources (e.g. What is the meaning of erb? and three out of the top four results from this google search) cite http://ruby-doc.org/stdlib-1.8.7/libdoc/erb/rdoc/ERB.ht

1条回答
  •  [愿得一人]
    2021-02-13 15:04

    erb was developed by Masatoshi Seki as a Ruby implementation of eRuby, so its specification almost follows that of eRuby. One difference the author mentions is:

    % cat hello.erb
    Hello, <% print "World" %>.
    
    % eruby hello.erb
    Hello, World.
    
    % erb hello.erb
    WorldHello, .
    

    in which case you can do:

    % cat hello2.erb
    Hello, <%= "World" %>.
    
    % eruby hello2.erb 
    Hello, World.
    
    % erb hello2.erb
    Hello, World.
    

    to let them work the same way.

    Here is an explanation about it by the author, and here and here are documentation written by the author.

    0 讨论(0)
提交回复
热议问题