PK œqhYî¶J‚ßF ßF ) nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Dir : /proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/ruby32/share/ruby/erb/ |
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 IP: 209.182.202.254 |
Dir : //proc/thread-self/root/proc/self/root/proc/self/root/opt/alt/ruby32/share/ruby/erb/def_method.rb |
#-- # ERB::DefMethod # # Utility module to define eRuby script as instance method. # # === Example # # example.rhtml: # <% for item in @items %> # <b><%= item %></b> # <% end %> # # example.rb: # require 'erb' # class MyClass # extend ERB::DefMethod # def_erb_method('render()', 'example.rhtml') # def initialize(items) # @items = items # end # end # print MyClass.new([10,20,30]).render() # # result: # # <b>10</b> # # <b>20</b> # # <b>30</b> # module ERB::DefMethod # define _methodname_ as instance method of current module, using ERB # object or eRuby file 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 module_function :def_erb_method end