#!/usr/bin/env ruby -w # $Id: component.rb,v 1.1 2003/12/08 18:40:07 radek Exp $ # $Source: /home/radek/cvs/ruby-book/example/net/web/borges02/component.rb,v $ # # Copyright (c) 2003 Radek Hnilica require 'borges' require 'borges/Page' include Borges class MyComponent < Page def render_on(r) r.heading 'MyComponent' r.anchor('Component Action') { action } end def action end end class MainPage < Page def render_on(r) r.heading 'Component example' # use MyComponent r.print "End Of Page" end end Borges::register_application("component", MainPage) if $0 == __FILE__ then require 'borges/Webrick' Borges::WebrickConnection.start({:Port=>7001}) end
Pokus o velmi jednoduchou aplikaci
#!/usr/bin/env ruby -w # $Id: app.rb,v 1.1 2003/12/08 18:40:07 radek Exp $ # $Source: /home/radek/cvs/ruby-book/example/net/web/borges02/app.rb,v $ # Copyright (c) 2003 Radek Hnilica require 'borges' require 'borges/Page' include Borges class MainPage < Page def render_on(r) r.heading 'App' end end Borges::register_application("app", MainPage) if $0 == __FILE__ then require 'borges/Webrick' Borges::WebrickConnection.start({:Port=>7002}) end