lib/core/facets/string/interpolate.rb in facets-2.9.3 vs lib/core/facets/string/interpolate.rb in facets-3.0.0

- old
+ new

@@ -1,14 +1,18 @@ class String - # Interpolate. Provides a means of extenally using Ruby string + # Interpolate provides a means of externally using Ruby string # interpolation mechinism. # # try = "hello" # str = "\#{try}!!!" # String.interpolate{ str } #=> "hello!!!" # - # NOTE: The block neccessary in order to get then binding of the caller. + # Note this uses #eval under the hood. We do not recommend that + # it serve in place of a good templating system. But, it can be + # useful for simple cases. + # + # The block is neccessary in order to get then binding of the caller. # # CREDIT: Trans def self.interpolate(&str) eval "%{#{str.call}}", str.binding