Sha256: 0c4634bf9d3849401cc18d162dbb15ea27a490ba1283f60467974f9c123c1b59
Contents?: true
Size: 473 Bytes
Versions: 212
Compression:
Stored size: 473 Bytes
Contents
require 'erubis' s = "hello <%= name %>" eruby = Erubis::Eruby.new(s) filename = 'hello.rhtml' ## define instance method to Dummy class (or module) class Dummy; end eruby.def_method(Dummy, 'render(name)', filename) # filename is optional p Dummy.new.render('world') #=> "hello world" ## define singleton method to dummy object obj = Object.new eruby.def_method(obj, 'render(name)', filename) # filename is optional p obj.render('world') #=> "hello world"
Version data entries
212 entries across 186 versions & 44 rubygems