• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/ruby-104/ruby/lib/

Lines Matching refs:ERB

2 # = ERB -- Ruby Templating
7 # See ERB for primary documentation and ERB::Util for a couple of utility
17 # = ERB -- Ruby Templating
21 # ERB provides an easy to use but powerful templating system for Ruby. Using
22 # ERB, actual Ruby code can be added to any plain text document for the
30 # template = ERB.new <<-EOF
42 # ERB recognizes certain tags in the provided template and converts them based
48 # % a line of Ruby code -- treated as <% line %> (optional -- see ERB.new)
52 # All other text is passed through ERB filtering unchanged.
57 # There are several settings you can change when you use ERB:
62 # See the ERB.new and ERB#result methods for more detail.
66 # ERB (or ruby code generated by ERB) returns a string in the same
74 # template = ERB.new <<EOF
87 # ERB is useful for any generic templating situation. Note that in this example, we use the
117 # message = ERB.new(template, 0, "%<>")
151 # ERB is often used in <tt>.rhtml</tt> files (HTML with embedded Ruby). Notice the need in
207 # rhtml = ERB.new(template)
251 # * ERB's big brother, eRuby, works the same but is written in C for speed;
257 # Rails, the web application framework, uses ERB to create views.
259 class ERB
264 "erb.rb [2.1.0 #{ERB::Revision.split[1]}]"
269 # ERB::Compiler
270 class ERB
271 # = ERB::Compiler
273 # Compiles ERB templates into Ruby code; the compiled code produces the
274 # template result when evaluated. ERB::Compiler provides hooks to define how
277 # Internally ERB does something like this to generate the code returned by
278 # ERB#src:
280 # compiler = ERB::Compiler.new('<>')
296 # compiler = ERB::Compiler.new('<>')
340 # Good! See also ERB#def_method, ERB#def_module, and ERB#def_class.
594 # Compiles an ERB template into Ruby code. Returns an array of the code
689 # Construct a new compiler using the trim_mode. See ERB::new for available
727 # ERB
728 class ERB
730 # Constructs a new ERB object with the template specified in _str_.
732 # An ERB object works by building a chunk of Ruby code that will output
734 # ERB code will be run in a separate thread with <b>$SAFE</b> set to the
738 # modifiers, ERB will adjust its code generation as listed:
745 # _eoutvar_ can be used to set the name of the variable ERB will build up
746 # its output in. This is useful when you need to run multiple ERB
770 # ERB.new(<<-'END_PRODUCT'.gsub(/^\s+/, ""), 0, "", "@product").result b
774 # ERB.new(<<-'END_PRICE'.gsub(/^\s+/, ""), 0, "", "@price").result b
804 # Creates a new compiler for ERB. See ERB::Compiler.new for details
807 ERB::Compiler.new(trim_mode)
810 # The Ruby code generated by ERB
813 # The optional _filename_ argument passed to Kernel#eval when the ERB code
818 # Can be used to set _eoutvar_ as described in ERB::new. It's probably
820 # requires the setup of an ERB _compiler_ object.
829 # Generate results and print them. (see ERB#result)
835 # Executes the generated ERB code to produce a completed template, returning
836 # the results of that code. (See ERB::new for details on how this process
866 # erb = ERB.new(File.read(filename))
869 def def_method(mod, methodname, fname='(ERB)')
881 # erb = ERB.new(File.read(filename))
889 def_method(mod, methodname, @filename || '(ERB)')
902 # erb = ERB.new(File.read(filename))
908 def_method(cls, methodname, @filename || '(ERB)')
914 # ERB::Util
915 class ERB
923 # include ERB::Util
942 # include ERB::Util
962 # ERB::DefMethod
963 class ERB
976 # extend ERB::DefMethod
994 # define _methodname_ as instance method of current module, using ERB
999 erb = ERB.new(File.read(fname))
1003 erb.def_method(self, methodname, erb.filename || '(ERB)')