Borges app registration: mystery solved

I think I understand what’s happening with the out-of-the-box Borges examples.
WEBrick.rb includes Borges.rb, which in turn includes all of the individual
components including the Counter example. Counter.rb has

class Borges::Counter < Borges::Component
  # ...

  register_application('counter')

end

This means register_application gets called when the file is required. That
method registers the application with the default dispatcher, which is the
object responsible for recoginizing the ‘/counter’ part of the URL.

The ‘tutorial’ app isn’t registered because the require statements for that
one and a few others are commented out of the top-level Borges.rb file.

This means that in order to add your own application you can add it to
Borges.rb.

Thanks for listening, everyone.

Jim

···


Jim Menard, jimm@io.com, http://www.io.com/~jimm/
“Yes, I know /. is slanted. It still irritates me though.”
– CrayzyJ on slashdot
"Well, if it wasn’t slanted it’d be |."
– Eunuchswear on slashdot

I think I understand what’s happening with the out-of-the-box Borges examples.
WEBrick.rb includes Borges.rb, which in turn includes all of the individual
components including the Counter example. Counter.rb has

class Borges::Counter < Borges::Component
  # ...

  register_application('counter')

end

This means register_application gets called when the file is required. That
method registers the application with the default dispatcher, which is the
object responsible for recoginizing the ‘/counter’ part of the URL.

Yep.

The ‘tutorial’ app isn’t registered because the require statements for that
one and a few others are commented out of the top-level Borges.rb file.

I haven’t bothered to verify that the tutorial app works yet, its
very Smalltalkish.

This means that in order to add your own application you can add it to
Borges.rb.

You don’t need to do this, from your application code, you should:

require ‘Borges’

class MyCounter < Borges::Component

register_application ‘mycounter’

end

See the SushiNet example in:

/usr/local/share/examples/ruby/Borges/

···

Jim Menard (jimm@io.com) wrote:


Eric Hodel - drbrain@segment7.net - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04