Module
Class Methods
lib/erb/def_method.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/erb/def_method.rb, line 36
def def_erb_method(methodname, erb_or_fname)
if erb_or_fname.kind_of? String
fname = erb_or_fname
erb = ERB.new(File.read(fname))
erb.def_method(self, methodname, fname)
else
erb = erb_or_fname
erb.def_method(self, methodname, erb.filename || '(ERB)')
end
end
define methodname as instance method of current module, using ERB
object or eRuby file
Instance Methods
lib/erb/def_method.rb
View on GitHub
# File tmp/rubies/ruby-master/lib/erb/def_method.rb, line 36
def def_erb_method(methodname, erb_or_fname)
if erb_or_fname.kind_of? String
fname = erb_or_fname
erb = ERB.new(File.read(fname))
erb.def_method(self, methodname, fname)
else
erb = erb_or_fname
erb.def_method(self, methodname, erb.filename || '(ERB)')
end
end
define methodname as instance method of current module, using ERB
object or eRuby file