From ae815860b1ab56cdf2f40e90d23d95b560bb77f8 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Tue, 16 Sep 2025 13:45:42 -0500 Subject: [ruby/erb] [DOC] Enhanced doc for ERB.result (https://github.com/ruby/erb/pull/73) https://github.com/ruby/erb/commit/04bb746fc7 --- lib/erb.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/erb.rb b/lib/erb.rb index 2cd134a6f1..61d577d18b 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -782,12 +782,30 @@ class ERB print self.result(b) end + # :markup: markdown + # + # :call-seq: + # result(binding = top_level) -> string + # + # Formats the string stored in template `self`; + # returns the string result: + # + # - Each [expression tag][expression tags] is replaced by the value of the embedded expression. + # - Each [execution tag][execution tags] is removed, and its embedded code is executed. + # - Each [comment tag][comment tags] is removed. + # + # See examples at the links. # - # Executes the generated ERB code to produce a completed template, returning - # the results of that code. + # Argument `binding` is a [binding object], + # which should contain the bindings needed for all expression tags; + # the default is #top_level. + # See [Bindings][bindings]. # - # _b_ accepts a Binding object which is used to set the context of - # code evaluation. + # [binding object]: https://docs.ruby-lang.org/en/master/Binding.html + # [bindings]: rdoc-ref:ERB@Bindings + # [comment tags]: rdoc-ref:ERB@Comment+Tags + # [execution tags]: rdoc-ref:ERB@Execution+Tags + # [expression tags]: rdoc-ref:ERB@Expression+Tags # def result(b=new_toplevel) unless @_init.equal?(self.class.singleton_class) -- cgit v1.2.3