"Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java"
each do |k,v| val = v.map{|ll| ''/>' }.join("\n") content.gsub! "",val end content end def source_for io case io when IO: StreamSource.new(IOInputStream.new(io)) when String: StreamSource.new(StringReader.new(io)) else raise ArgumentError, "couldn't handle argument of type #{io.class}" end end def input_source_for io case io when IO: InputSource.new(IOInputStream.new(io)) when String: InputSource.new(StringReader.new(io)) else raise ArgumentError, "couldn't handle argument of type #{io.class}" end end The only strange part of these helpers is render_options, which allows you to add something like to your XSLT output, which is replaced with the corresponding data generated with the link strings. This isn??™t dynamic enough, but you see how it would be possible to add any kind of content here. The options hash could contain blocks that generate the correct strings when called, or something similar to that. This is all there is to the rendering of content in CoMpoSe. As said before, you can do almost anything with this code and add whatever kinds of features you??™d like, but this is the basis for content rendering. CHAPTER 8 ?– CONTENT RENDERING 160 Content You need a controller that??™s responsible for generating the content. It shouldn??™t be secured, and you don??™t need any views for it either: jruby script/generate controller compose default_render style rm -rf app/views/compose You need two different actions for this: one for regular rendering, and one for serving style sheets.