ruby-changes:58455
From: zverok <ko1@a...>
Date: Sun, 27 Oct 2019 02:24:52 +0900 (JST)
Subject: [ruby-changes:58455] f6f1377a4e (master): Update ERB docs
https://git.ruby-lang.org/ruby.git/commit/?id=f6f1377a4e From f6f1377a4ec187579a7dd0249be1166b42bf668b Mon Sep 17 00:00:00 2001 From: zverok <zverok.offline@g...> Date: Sat, 26 Oct 2019 09:34:14 +0300 Subject: Update ERB docs * Actualize Notes about other templating engines; * Document #location= method. diff --git a/lib/erb.rb b/lib/erb.rb index df9a1e9..3f26c2f 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -248,15 +248,13 @@ require "cgi/util" https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L248 # # == Notes # -# There are a variety of templating solutions available in various Ruby projects: -# * ERB's big brother, eRuby, works the same but is written in C for speed; -# * Amrita (smart at producing HTML/XML); -# * cs/Template (written in C for speed); -# * RDoc, distributed with Ruby, uses its own template engine, which can be reused elsewhere; -# * and others; search {RubyGems.org}[https://rubygems.org/] or -# {The Ruby Toolbox}[https://www.ruby-toolbox.com/]. +# There are a variety of templating solutions available in various Ruby projects. +# For example, RDoc, distributed with Ruby, uses its own template engine, which +# can be reused elsewhere. # -# Rails, the web application framework, uses ERB to create views. +# Other popular engines could be found in the corresponding +# {Category}[https://www.ruby-toolbox.com/categories/template_engines] of +# The Ruby Toolbox. # class ERB Revision = '$Date:: $' # :nodoc: #' @@ -861,6 +859,21 @@ class ERB https://github.com/ruby/ruby/blob/trunk/lib/erb.rb#L859 # is run attr_accessor :lineno + # + # Sets optional filename and line number that will be used in ERB code + # evaluation and error reporting. See also #filename= and #lineno= + # + # erb = ERB.new('<%= some_x %>') + # erb.render + # # undefined local variable or method `some_x' + # # from (erb):1 + # + # erb.location = ['file.erb', 3] + # # All subsequent error reporting would use new location + # erb.render + # # undefined local variable or method `some_x' + # # from file.erb:4 + # def location=((filename, lineno)) @filename = filename @lineno = lineno if lineno -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/