From ef01839ed97de35a7b9de71cf41a68c74d35e795 Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Tue, 16 Sep 2025 19:30:59 +0100 Subject: [PATCH] [DOC] Enhanced doc for ERB.result --- lib/erb.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/erb.rb b/lib/erb.rb index 9a91f76..efb0fc6 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -762,12 +762,30 @@ def run(b=new_toplevel) 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)