diff options
| -rw-r--r-- | lib/erb.rb | 26 |
1 files 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) |
