[Nitro] Cannot require 'builder' in a Nitro app

Bryan Soto bryan.a.soto at gmail.com
Fri Jan 20 21:15:53 EST 2006

On 1/20/06, James Britt <james_b at neurogami.com> wrote:
> I'm trying to use Jim Wierich's XML Builder library in Nitro to create
> atom and rss feeds.  I cannot call "require 'builder'" without errors.
> Are there special libraries that cannot be used wth Nitro?
> Is there a trick to including certain libraries?

Hi James,

I wish I had a simple answer for you. Basic problem is a collision between
Jim's  Builder and Glue::Builder and Glue being included into the top level
namespace by default. There is a $GLUE_DONT_INCLUDE flag, but it doesn't
appear to have been tested against as setting it before requiring nitro
gives some missing constant errors. I'll try to get a patch in to fix

In the mean time, there is an XmlHelper and RssHelper (0.9) available in
Nitro. Hopefully they'll meet your needs. Docs available via gem_server or


# Sample of RssHelper usage

class TC_RssHelper < Test::Unit::TestCase # :nodoc: all
  include Nitro
  include RssHelper

  Blog = Struct.new(:title, :body, :to_href)

  def test_render
    blogs = []
    blogs << Blog.new('Hello1', 'World1', 'uri1');
    blogs << Blog.new('Hello2', 'World2', 'uri2');
    blogs << Blog.new('Hello3', 'World3', 'uri3');

    rss = build_rss(blogs, :link => 'http://www.navel.gr')

    assert_match %r{<link>http://www.navel.gr/uri1</link>}, rss
    assert_match %r{<link>http://www.navel.gr/uri2</link>}, rss


- - - - -

# flare/src/controller.rb

    build do |r|
      r.pi! :xml, :version => '1.0', :encoding => 'utf-8'
      r.respose do
        if error_message
          r.error '1'
          r.message error_message
          r.error '0'

- - - - -

Sorry about the stumbling block, but I hope this helps.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060120/b6eaad7b/attachment.html 

More information about the Nitro-general mailing list