Page filter that evaluates Ruby code in it‘s body in the current interpreter. The code is directly evaluated, and anything it writes to standard out becomes the macro replacement.

Obviously you can place Ruby code directly in your pages, using ERB, and for many cases that is the route you should take. There is a (somewhat) subtle difference between the to alternatives however: ERB is always evaluated right at the start of rendering, before any Text Filters are run, whereas #:eval# code is executed during the page filter stage, which happens after ERB and text filtering, but before layout is applied.

Public Class methods
new(macro_re = MACRO_RE)
    # File lib/rote/filters/eval.rb, line 31
31:       def initialize(macro_re = MACRO_RE)
32:         super([],macro_re)
33:       end
Public Instance methods
    # File lib/rote/filters/eval.rb, line 35
35:       def macro_eval(cmd,body,raw)
36:         # no need to fiddle with $SAFE here is there?
38:         # FIXME this is a hack.
40:         # Utility is still limited I guess, since current Page isn't
41:         # readily available to the macro code. We can probably fix
42:         # that though.
44:         # If thread safety becomes an issue, this'll probably need 
45:         # to be critical sectioned.
47:         begin
48:           oldsio, $stdout = $stdout,
49:           eval body        
50:           $stdout.rewind
51:           $
52:         ensure
53:           $stdout = oldsio
54:         end
55:       end