[#118612] OS X Tiger still including ruby 1.6 — Carl Youngblood <carl.youngblood@...>

I'm not sure who to talk to about this, but in my correspondence with

17 messages 2004/11/01

[#118651] symbol solver.. early experiments — Simon Strandgaard <neoneye@...>

Hi,

11 messages 2004/11/01

[#118675] fastcgi performance problems and ruby — andrew.stuart@...

Hello

16 messages 2004/11/02

[#118679] US Presidential Election — "trans. (T. Onoma)" <transami@...>

Election Day is upon us!

135 messages 2004/11/02
[#118681] Re: [OT] US Presidential Election — James Britt <jamesUNDERBARb@...> 2004/11/02

trans. (T. Onoma) wrote:

[#118690] Re: [OT] US Presidential Election — Ara.T.Howard@... 2004/11/02

On Tue, 2 Nov 2004, trans. (T. Onoma) wrote:

[#118696] Re: [OT] US Presidential Election — Logan Capaldo <logancapaldo@...> 2004/11/02

I am neither a Kerry or Bush supporter. Idealy I would vote

[#118734] Re: [OT] US Presidential Election — Richard Kilmer <rich@...> 2004/11/02

Bush, with conviction ;-)

[#118744] Re: [OT] US Presidential Election — Thomas Kirchner <lists@...> 2004/11/02

On Tue, Nov 02, 2004 at 09:18:12PM +0900, Richard Kilmer wrote:

[#118836] From getoptlong to optparse — Massimiliano Mirra - bard <mmirra@...>

15 messages 2004/11/02

[#118863] Programmatically and dynamically catching exceptions — Logan Capaldo <logancapaldo@...>

Allright here was my idea which seems to have been shattered by the

13 messages 2004/11/03

[#118965] Ruby Package for MacOS X — Mark Hubbart <discordantus@...>

Hi all,

11 messages 2004/11/04

[#118970] Ruby and civil political discussion? (Re: [OT] US Presidential Election) — "Dave Burt" <burtdav@...>

"David Morton" <mortonda@gmail.com> wrote:

18 messages 2004/11/04

[#118988] rails: gem install rails is bombing — "J. D." <jd@...>

Hi,

11 messages 2004/11/04
[#118994] Re: rails: gem install rails is bombing — David Heinemeier Hansson <david@...> 2004/11/04

> I'm running into a problem installing rails using gem. How do I fix

[#118997] Ruby BitTorrent — (Curne) Simon Conrad-Armes <curne@...>

Has anybody started a Ruby BitTorrent transfer library? I wanted to

13 messages 2004/11/04

[#119059] Will ActiveRecord support Berkeley DB? — "J. D." <jd@...>

Hi,

13 messages 2004/11/04

[#119111] FastCGI parameters (get and post) — "J. D." <jd@...>

Hi,

21 messages 2004/11/04
[#119114] Re: FastCGI parameters (get and post) — Kent Sibilev <ksibilev@...> 2004/11/04

GET parameters you have to parse from ENV['QUERY_STRING'].

[#119117] Re: FastCGI parameters (get and post) — "J. D." <jd@...> 2004/11/04

Kent Sibilev wrote:

[#119176] Re: FastCGI parameters (get and post) — Patrick May <patrick@...> 2004/11/05

[#119208] Re: FastCGI parameters (get and post) — MoonWolf <moonwolf@...> 2004/11/05

Patrick May wrote:

[#119275] Re: FastCGI parameters (get and post) — Patrick May <patrick@...> 2004/11/05

Quoting MoonWolf <moonwolf@moonwolf.com>:

[#119289] Re: FastCGI parameters (get and post) — gabriele renzi <rff_rff@...> 2004/11/05

Patrick May ha scritto:

[#119357] Re: FastCGI parameters (get and post) — Patrick May <patrick@...> 2004/11/06

[#119358] Re: FastCGI parameters (get and post) — Ara.T.Howard@... 2004/11/06

On Sun, 7 Nov 2004, Patrick May wrote:

[#119132] recursive brace matching with Ruby regexp — Jason Sweat <jason.sweat@...>

I wanted to learn Ruby, so I picked a small task of trying to write a

19 messages 2004/11/05
[#119149] Re: recursive brace matching with Ruby regexp — Mark Hubbart <discordantus@...> 2004/11/05

Hi,

[#119161] Re: recursive brace matching with Ruby regexp — James Edward Gray II <james@...> 2004/11/05

On Nov 4, 2004, at 8:04 PM, Mark Hubbart wrote:

[#119148] Ruby 1.4.6 - trouble with require path — primehalo@... (Ken Innes)

I inherited a project that uses Ruby 1.4.6 on a RedHat Linux 6.1J. I

12 messages 2004/11/05

[#119168] value provided for argument with default value - how to check inside method? — "itsme213" <itsme213@...>

Is there an equivalent of block_given? to check if the caller provided a

16 messages 2004/11/05

[#119223] GEDCOM Parser (#6) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

40 messages 2004/11/05
[#119224] Re: [QUIZ] GEDCOM Parser (#6) — Jim Menard <jimm@...> 2004/11/05

> <gedcom>

[#119371] Documenting accessor methods as methods — James Britt <jamesUNDERBARb@...>

I sometimes use the method definition shorthand 'attr_reader',

29 messages 2004/11/06
[#119373] Re: [RDOC] Documenting accessor methods as methods — Gavin Kistner <gavin@...> 2004/11/07

On Nov 6, 2004, at 4:23 PM, James Britt wrote:

[#119386] Re: [RDOC] Documenting accessor methods as methods — Dave Thomas <dave@...> 2004/11/07

[#119406] Re: [RDOC] Documenting accessor methods as methods — James Britt <jamesUNDERBARb@...> 2004/11/07

Dave Thomas wrote:

[#119417] Re: [RDOC] Documenting accessor methods as methods — Dave Thomas <dave@...> 2004/11/07

[#119428] Re: [RDOC] Documenting accessor methods as methods — James Britt <jamesUNDERBARb@...> 2004/11/07

Dave Thomas wrote:

[#119432] Re: [RDOC] Documenting accessor methods as methods — Sam Roberts <sroberts@...> 2004/11/07

Quoteing jamesUNDERBARb@neurogami.com, on Mon, Nov 08, 2004 at 04:26:26AM +0900:

[#119439] Re: [RDOC] Documenting accessor methods as methods — James Britt <jamesUNDERBARb@...> 2004/11/07

Sam Roberts wrote:

[#119535] rdoc and vim folding — "Ara.T.Howard" <Ara.T.Howard@...>

24 messages 2004/11/08
[#119540] Re: rdoc and vim folding — Dave Thomas <dave@...> 2004/11/08

[#119543] Re: rdoc and vim folding — Hans Fugal <hans@...> 2004/11/09

Dave Thomas wrote:

[#119545] Re: rdoc and vim folding — "Ara.T.Howard" <Ara.T.Howard@...> 2004/11/09

On Mon, 8 Nov 2004, Hans Fugal wrote:

[#119597] One-Click Installer 1.8.2-14 RC9 with RubyGems built-in — "Curt Hibbs" <curt@...>

This release candidate of the One-Click Installer for

22 messages 2004/11/09

[#119598] RedCloth 3.0.0 -- Textile and Markdown Elope! — why the lucky stiff <ruby-talk@...>

RedCloth 3 is out. You know? RedCloth? Perhaps you've heard of it.

14 messages 2004/11/09

[#119607] Iterating trough hash — Kevin =?ISO-8859-15?Q?B=F6rgens?= <kevin@...>

Hi!

19 messages 2004/11/09

[#119685] new spam at the wiki — Edwin Eyan Moragas <haaktu@...>

been checking my pages and it looks like we've got a new spammer on board.

41 messages 2004/11/10
[#119708] Re: new spam at the wiki — Jim Weirich <jim@...> 2004/11/10

On Wednesday 10 November 2004 02:00 am, Edwin Eyan Moragas wrote:

[#119748] Re: new spam at the wiki — Asfand Yar Qazi <see@...> 2004/11/10

Jim Weirich wrote:

[#119754] Re: new spam at the wiki — Henrik Horneber <ryco@...> 2004/11/10

Asfand Yar Qazi wrote:

[#119756] Re: new spam at the wiki — Charles Comstock <cc1@...> 2004/11/10

[#119796] A Wiki/Spam Report — "Jim Weirich" <jim@...> 2004/11/10

Hello all.

[#119895] Re: A Wiki/Spam Report — Ben Giddings <bg-rubytalk@...> 2004/11/11

Jim Weirich wrote:

[#119911] Re: A Wiki/Spam Report — gabriele renzi <rff_rff@...> 2004/11/11

Ben Giddings ha scritto:

[#119935] Re: A Wiki/Spam Report — "Jim Weirich" <jim@...> 2004/11/11

[#119799] array.each restart when array is changed — Kevin =?ISO-8859-15?Q?B=F6rgens?= <kevin@...>

Hi!

18 messages 2004/11/10

[#119825] Arachno users? — "itsme213" <itsme213@...>

Any Arachno IDE users out there? Do you mind sharing your opinion of the

16 messages 2004/11/11
[#119908] Re: Arachno users? — Wayne Vucenic <nightphotos@...> 2004/11/11

I've been programming in Ruby for 3 years, and using ArachnoRuby for

[#119826] ruby idiom for attribute definition? — "Corey" <corey_s@...>

19 messages 2004/11/11

[#119878] Thinking About Java Interfaces In Ruby — James Edward Gray II <james@...>

I'm currently reading "Holub on Patterns", an excellent volume on

18 messages 2004/11/11

[#119974] warning: redefining Object#initialize may cause infinite loop — Stu <ceaser@...>

12 messages 2004/11/12

[#120037] Copland to Needle article on RubyGarden — Chad Fowler <chadfowler@...>

For those not subscribed to RubyGarden's rss feed[1], Jamis Buck has

35 messages 2004/11/12
[#120214] Re: [ANN] Copland to Needle article on RubyGarden (LONG) — Joel VanderWerf <vjoel@...> 2004/11/13

Chad Fowler wrote:

[#120431] Starter question on Test::Unit — Mohammad Khan <mkhan@...> 2004/11/15

Hello,

[#120056] Countdown (#7) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

26 messages 2004/11/12

[#120061] why does rss/maker not raise errors? — Sam Roberts <sroberts@...>

There are lots of mandatory attributes (yes, which are mandatory is

26 messages 2004/11/12
[#120133] bug: rss/maker is requiring <image> for rss/0.9 — Sam Roberts <sroberts@...> 2004/11/13

It says it is optional here:

[#120071] assert — "itsme213" <itsme213@...>

I could not find a standard "assert" in Ruby. Is there one?

29 messages 2004/11/12

[#120248] Dynamic define_method on class creation per module namespace — "trans. (T. Onoma)" <transami@...>

Here's a wee challenge for Rubyists at large. Consider:

12 messages 2004/11/14

[#120261] Countdown (#7) — Dennis Ranke <dennis.ranke@...>

Hi, here is my second solution for this very interesting quiz.

15 messages 2004/11/14

[#120271] Ruby in the enterprise... — "Wood, Jeff" <jeffwood@...>

Hello all,=20

14 messages 2004/11/14

[#120299] OpenStruct#update ? — "trans. (T. Onoma)" <transami@...>

How 'bout an OpenStruct#update for adding values after initialization. Or is

72 messages 2004/11/14
[#120306] Re: OpenStruct#update ? — "trans. (T. Onoma)" <transami@...> 2004/11/14

On Sunday 14 November 2004 03:42 pm, trans. (T. Onoma) wrote:

[#120337] Re: OpenStruct#update ? — Yukihiro Matsumoto <matz@...> 2004/11/14

Hi,

[#120355] Re: OpenStruct#update ? — "trans. (T. Onoma)" <transami@...> 2004/11/15

On Sunday 14 November 2004 06:16 pm, Yukihiro Matsumoto wrote:

[#120395] Re: OpenStruct#update ? — Florian Gross <flgr@...> 2004/11/15

trans. (T. Onoma) wrote:

[#120401] Kernel#singleton_class (was: Re: OpenStruct#update ?) — "David A. Black" <dblack@...> 2004/11/15

Hi --

[#120405] Re: Kernel#singleton_class — Florian Gross <flgr@...> 2004/11/15

David A. Black wrote:

[#120407] Re: Kernel#singleton_class — "David A. Black" <dblack@...> 2004/11/15

Hi --

[#120446] Re: Kernel#singleton_class — Yukihiro Matsumoto <matz@...> 2004/11/15

Hi,

[#120449] Re: Kernel#singleton_class — "trans. (T. Onoma)" <transami@...> 2004/11/15

On Monday 15 November 2004 12:28 pm, Yukihiro Matsumoto wrote:

[#120380] Arachno Ruby 0.3 (patch 2) — Lothar Scholz <mailinglists@...>

Hello,

16 messages 2004/11/15

[#120485] rpa-base 0.2.3 — Mauricio Fern疣dez <batsman.geo@...>

15 messages 2004/11/15
[#120516] Re: [ANN] rpa-base 0.2.3 — Matt Armstrong <matt@...> 2004/11/16

[#120626] Re: [ANN] rpa-base 0.2.3 — Mauricio Fern疣dez <batsman.geo@...> 2004/11/17

On Tue, Nov 16, 2004 at 02:08:23PM +0900, Matt Armstrong wrote:

[#120573] Can't Build Ruby 1.8.1 on HP-UX 11.00 — Kevin Hinners <kevin.hinners@...>

I've downloaded the stable 1.8.1 release of Ruby. When I attempt to run make

21 messages 2004/11/16
[#120574] Re: Can't Build Ruby 1.8.1 on HP-UX 11.00 — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#120577] Re: Can't Build Ruby 1.8.1 on HP-UX 11.00 — Kevin Hinners <kevin.hinners@...> 2004/11/16

Top segment of mkmk.log:

[#120582] Re: Can't Build Ruby 1.8.1 on HP-UX 11.00 — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#120609] Ruby to C to another language (perhaps Java (I Don't Need JRuby)) — Zach Dennis <zdennis@...>

This posting is more for a learning thing then anything else at this

10 messages 2004/11/17

[#120727] About Regular Expressions — Nikolai Weibull <mailing-lists.ruby-talk@...>

Lately there have been a bunch of posts on this list about regular

31 messages 2004/11/18
[#120739] Re: About Regular Expressions — "trans. (T. Onoma)" <transami@...> 2004/11/18

On Thursday 18 November 2004 05:34 am, Nikolai Weibull wrote:

[#120745] Re: About Regular Expressions — Nikolai Weibull <mailing-lists.ruby-talk@...> 2004/11/18

* trans. (T. Onoma) <transami@runbox.com> [Nov 18, 2004 14:10]:

[#120764] Re: About Regular Expressions — "trans. (T. Onoma)" <transami@...> 2004/11/18

On Thursday 18 November 2004 09:26 am, Nikolai Weibull wrote:

[#120754] postgres-pr (pure Ruby PostgreSQL) — Michael Neumann <mneumann@...>

Hi,

30 messages 2004/11/18
[#120772] Re: [ANN] postgres-pr (pure Ruby PostgreSQL) — David Ross <dross@...> 2004/11/18

Michael Neumann wrote:

[#120870] Re: [ANN] postgres-pr (pure Ruby PostgreSQL) — David Garamond <lists@...6.isreserved.com> 2004/11/19

David Ross wrote:

[#120877] Re: [ANN] postgres-pr (pure Ruby PostgreSQL) — Mauricio Fern疣dez <batsman.geo@...> 2004/11/19

On Fri, Nov 19, 2004 at 04:42:36PM +0900, David Garamond wrote:

[#120872] mission critical Ruby? — Mark VanOrman <mark@...>

Hi all,

14 messages 2004/11/19

[#120890] Object Browser (#8) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

65 messages 2004/11/19
[#121006] Re: [SOLUTION] Object Browser (#8) — "R. Mark Volkmann" <mark@...> 2004/11/22

I'm new to using gems. Can you tell me the command I need to run to get

[#121093] Object Browser (#8) — Brian =?ISO-8859-15?Q?Schr=F6der?= <ruby@...> 2004/11/23

Hello Group,

[#121357] Re: [Solution] Object Browser (#8) — Brian =?ISO-8859-15?Q?Schr=F6der?= <ruby@...> 2004/11/25

So I took some time and refactored my solution. It now has a modular and extendible structure (at least I hope so). It should be possible to easily write non-gtk ui's and extend the reporting capabilities.

[#120940] Inner Class Relationship — James Edward Gray II <james@...>

I have an inner class that needs to send it's parent object (outer

24 messages 2004/11/20
[#120946] Re: Inner Class Relationship — Francis Hwang <sera@...> 2004/11/20

Since you haven't said much about how you're using this, maybe my

[#120947] Re: Inner Class Relationship — James Edward Gray II <james@...> 2004/11/21

On Nov 20, 2004, at 5:55 PM, Francis Hwang wrote:

[#120952] Re: Inner Class Relationship — Francis Hwang <sera@...> 2004/11/21

[#120961] Windows - calling system with multiple parms — colotechpro@... (John Reed)

I'm having a problem getting a system call to Windows XP to work. I

13 messages 2004/11/21

[#121015] Some progress but have hit a new error working through the Todo tutorial... Anyone recognize it? — "Abraham Vionas" <abe_ml@...>

The error is below. Ugh. But at least it works up to this point. I don't

12 messages 2004/11/22
[#121016] Re: Some progress but have hit a new error working through the Todo tutorial... Anyone recognize it? — "Abraham Vionas" <abe_ml@...> 2004/11/22

Oh, whups. The state of the todo_controller.rb file that evokes this error

[#121026] Instiki problems — Ryco@...

Hi!

19 messages 2004/11/22
[#121031] Re: Instiki problems — Ryco@... 2004/11/22

Update:

[#121129] Re: Instiki problems — Ryco@... 2004/11/23

Hi!

[#121126] rails is awesome — Dick Davies <rasputnik@...>

46 messages 2004/11/23
[#121134] Re: rails is awesome — David Heinemeier Hansson <david@...> 2004/11/23

> Couldn't help sending a big 'thank you' to DHH for Rails.

[#121194] Re: rails is awesome — Austin Ziegler <halostatue@...> 2004/11/23

On Tue, 23 Nov 2004 20:11:24 +0900, David Heinemeier Hansson

[#121196] Re: rails is awesome — David Heinemeier Hansson <david@...> 2004/11/23

> I haven't seen this myself, but from something said by others, it

[#121217] Re: rails is awesome — Austin Ziegler <halostatue@...> 2004/11/24

On Wed, 24 Nov 2004 07:01:17 +0900, David Heinemeier Hansson

[#121243] Re: rails is awesome — David Heinemeier Hansson <david@...> 2004/11/24

> Essentially, David, this is a *problem* with ActiveRecord.

[#121247] Re: rails is awesome — Gavin Sinclair <gsinclair@...> 2004/11/24

On Wednesday, November 24, 2004, 9:23:09 PM, David wrote:

[#121260] Re: rails is awesome — Austin Ziegler <halostatue@...> 2004/11/24

On Wed, 24 Nov 2004 19:48:18 +0900, Gavin Sinclair

[#121267] Other ORMs [was: rails is awesome] — Francis Hwang <sera@...> 2004/11/24

[#121271] Re: Other ORMs [was: rails is awesome] — George Moschovitis <gm@...> 2004/11/24

> do, maybe it's worth considering that ActiveRecord is not not the only

[#121274] Re: Other ORMs [was: rails is awesome] — Austin Ziegler <halostatue@...> 2004/11/24

On Wed, 24 Nov 2004 22:58:09 +0900, George Moschovitis <gm@navel.gr> wrote:

[#121275] Re: Other ORMs [was: rails is awesome] — Francis Hwang <sera@...> 2004/11/24

Austin, what DB are you using anyway? Dunno if I caught that in this

[#121173] Most popular wiki in Ruby seeks kind maintainer — David Heinemeier Hansson <david@...>

Okay, okay, okay. Instiki does need a new maintainer. At least a

12 messages 2004/11/23
[#121195] Re: Most popular wiki in Ruby seeks kind maintainer — Austin Ziegler <halostatue@...> 2004/11/23

On Wed, 24 Nov 2004 02:35:21 +0900, David Heinemeier Hansson

[#121210] Marshal vs. YAML vs. something else (Re: Most popular wiki in Ruby seeks kind maintainer) — Francis Hwang <sera@...> 2004/11/24

More generally, let me ask: What formats are people using to persist

[#121205] How to avoid inheriting Object? — "itsme213" <itsme213@...>

How do I create a class that does not inherit from Object?

17 messages 2004/11/24
[#121218] Re: How to avoid inheriting Object? — Austin Ziegler <halostatue@...> 2004/11/24

On Wed, 24 Nov 2004 10:29:09 +0900, itsme213 <itsme213@hotmail.com> wrote:

[#121227] editors/IDEs — Jamie Orchard-Hays <jamie@...>

I'm curious what people are favoring for editors and IDEs for Ruby.

21 messages 2004/11/24

[#121318] Ruby/DL tutorial — bjsp123@... (Benjamin Peterson)

Hi,

15 messages 2004/11/24

[#121381] Re: Ruby GUIs and installation effort — "bin liu" <ruby@3cn.com.cn>

I think one GUI system dos not depends others except ruby will bee more flexible.

19 messages 2004/11/25

[#121455] Using unit-tests as examples for a documentation — benny <listen@...>

dear list,

13 messages 2004/11/25

[#121468] oneclick installer, freeride — tony summerfelt <snowzone5@...>

anybody NOT developing the oneclick installer or freeride can skip

12 messages 2004/11/25

[#121506] Multiplexer - linear non-blocking I/O — Mikael Brockman <mikael@...>

Blocking I/O is really easy to use. But when you use it to write

32 messages 2004/11/26

[#121517] Banned Words (#9) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

29 messages 2004/11/26

[#121611] initialize always — "trans. (T. Onoma)" <transami@...>

It is rather a common occurrence that I find myself creating a mixin module

16 messages 2004/11/27

[#121647] One-Click Installer 1.8.2-14 RC10 — "Curt Hibbs" <curt@...>

This release is mainly in upgrade the included FreeRIDE

13 messages 2004/11/28

[#121730] Seeking advice on some method names — Gavin Sinclair <gsinclair@...>

Hi all,

28 messages 2004/11/29

[#121847] to_s, inspect, etc. — "itsme213" <itsme213@...>

Where would I find a nice summary of to_s, inspect, p, etc. and the core

16 messages 2004/11/29

[#121903] PHP vs. Ruby vs. Python (vs. Rails) — "Abraham Vionas" <abe_ml@...>

As I was falling asleep last night I was wondering about the differences in

15 messages 2004/11/30

[#121916] Python 2.4 released — Zach Dennis <zdennis@...>

A coworker of mine came and hollarred at me because on /. it mentioned

21 messages 2004/11/30

[#121936] Optional static typing (or, What can Ruby 2.0 borrow from Boo?) — djberg96@... (Daniel Berger)

Hi all,

23 messages 2004/11/30

[#121943] profile — "Joe Van Dyk" <joe.vandyk@...>

Hi,

24 messages 2004/11/30

[#121949] singleton methods : when are they not permitted? — "itsme213" <itsme213@...>

irb(main):025:0> x = :any

20 messages 2004/11/30
[#121956] Re: singleton methods : when are they not permitted? — Florian Gross <flgr@...> 2004/11/30

itsme213 wrote:

[#121970] Re: singleton methods : when are they not permitted? — Francis Hwang <sera@...> 2004/12/01

[#121975] Re: singleton methods : when are they not permitted? — Christoph <chr_mail@...> 2004/12/01

Francis Hwang schrieb:

Re: assert

From: Florian Gross <flgr@...>
Date: 2004-11-13 08:38:28 UTC
List: ruby-talk #120153
itsme213 wrote:

>>There's one in the dev-utils package. It will automatically set a
>>breakpoint if the application is run in debug mode and therefore give
>>you an irb shell where you can find out why your assert failed.
> That would work nice ... but I could not find it.

Oh, you are right. It is not yet included in dev-utils because of its 
name. I have attached my local version of breakpoint.rb which includes it.

I have thought about changing the name to "assume" so it can be included 
in dev-utils, but I'm not sure if that name is better.

Attachments (3)

breakpoint_client.rb (2.24 KB, text/x-ruby)
require 'breakpoint'
require 'optparse'

options = {
  :ClientURI  => nil,
  :ServerURI  => "druby://localhost:42531",
  :RetryDelay => 10
}

ARGV.options do |opts|
  script_name = File.basename($0)
  opts.banner = [
    "Usage: ruby #{script_name} [options] [server uri]",
    "",
    "This tool lets you connect to a breakpoint service ",
    "which was started via Breakpoint.activate_drb.",
    "",
    "The server uri defaults to druby://localhost:42531"
  ].join("\n")

  opts.separator ""

  opts.on("-c", "--client-uri=uri",
    "Run the client on the specified uri.",
    "This can be used to specify the port",
    "that the client uses to allow for back",
    "connections from the server.",
    "Default: Find a good URI automatically.",
    "Example: -c druby://localhost:12345"
  ) { |options[:ClientURI]| }

  opts.on("-s", "--server-uri=uri",
    "Connect to the server specified at the",
    "specified uri.",
    "Default: druby://localhost:42531"
  ) { |options[:ServerURI]| }

  opts.on("-R", "--retry-delay=delay", Integer,
    "Automatically try to reconnect to the",
    "server after delay seconds when the",
    "connection failed or timed out.",
    "A value of 0 disables automatical",
    "reconnecting completely.",
    "Default: 10"
  ) { |options[:RetryDelay]| }

  opts.separator ""

  opts.on("-h", "--help",
    "Show this help message."
  ) { puts opts; exit }

  opts.parse!
end

options[:ServerURI] = ARGV[0] if ARGV[0]

DRb.start_service(options[:ClientURI])

begin
  service = DRbObject.new(nil, options[:ServerURI])

  begin
    service.register_handler do |workspace, message|
      puts message
      IRB.start(nil, nil, workspace)
    end

    service.register_exit_handler do
      # Need to delay this because server expects a response
      Thread.new do
        puts "Received shut down signal."
        sleep 1
        exit!
      end

      nil
    end

    sleep
  ensure
    service.unregister_handler
    service.unregister_exit_handler
  end
rescue Exception => error
  if options[:RetryDelay] > 0 then
    puts "No connection to breakpoint service at #{options[:ServerURI]}:",
         "  (#{error})",
         "  Reconnecting in #{options[:RetryDelay]} seconds..."
 
    sleep options[:RetryDelay]
    retry
  else
    raise
  end
end
binding_of_caller.rb (2.54 KB, text/x-ruby)
begin
  require 'simplecc'
rescue LoadError
  def Continuation.create(*args, &block)
    cc = nil; result = callcc {|c| cc = c; block.call(cc) if block and args.empty?}
    result ||= args
    return *[cc, *result]
  end
end

# This method returns the binding of the method that called your
# method. It will raise an Exception when you're not inside a method.
#
# It's used like this:
#   def inc_counter(amount = 1)
#     Binding.of_caller do |binding|
#       # Create a lambda that will increase the variable 'counter'
#       # in the caller of this method when called.
#       inc = eval("lambda { |arg| counter += arg }", binding)
#       # We can refer to amount from inside this block safely.
#       inc.call(amount)
#     end
#     # No other statements can go here. Put them inside the block.
#   end
#   counter = 0
#   2.times { inc_counter }
#   counter # => 2
#
# Binding.of_caller must be the last statement in the method.
# This means that you will have to put everything you want to
# do after the call to Binding.of_caller into the block of it.
# This should be no problem however, because Ruby has closures.
# If you don't do this an Exception will be raised. Because of
# the way that Binding.of_caller is implemented it has to be
# done this way.
def Binding.of_caller(&block)
  old_critical = Thread.critical
  Thread.critical = true
  count = 0
  cc, result, error, extra_data = Continuation.create(nil, nil)
  error.call if error

  tracer = lambda do |*args|
    type, context, extra_data = args[0], args[4], args
    if type == "return"
      count += 1
      # First this method and then calling one will return --
      # the trace event of the second event gets the context
      # of the method which called the method that called this
      # method.
      if count == 2
        # It would be nice if we could restore the trace_func
        # that was set before we swapped in our own one, but
        # this is impossible without overloading set_trace_func
        # in current Ruby.
        set_trace_func(nil)
        cc.call(eval("binding", context), nil, extra_data)
      end
    elsif type != "line"
      set_trace_func(nil)
      error_msg = "Binding.of_caller used in non-method context or " +
        "trailing statements of method using it aren't in the block."
      cc.call(nil, lambda { raise(ArgumentError, error_msg) }, nil)
    end
  end

  unless result
    set_trace_func(tracer)
    return nil
  else
    Thread.critical = old_critical
    case block.arity
      when 1 then yield(result)
      else yield(result, extra_data)        
    end
  end
end
breakpoint.rb (9.57 KB, text/x-ruby)
require 'irb'
require 'binding_of_caller'
require 'drb'

module Breakpoint
  extend self

  # This will pop up an interactive ruby session at a
  # pre-defined break point in a Ruby application. In
  # this session you can examine the environment of
  # the break point.
  #
  # You can get a list of variables in the context using
  # local_variables via +local_variables+. You can then
  # examine their values by typing their names.
  #
  # You can have a look at the call stack via +caller+.
  #
  # The source code around the location where the breakpoint
  # was executed can be examined via +source_lines+. Its
  # argument specifies how much lines of context to display.
  # The default amount of context is 5 lines. Note that
  # the call to +source_lines+ can raise an exception when
  # it isn't able to read in the source code.
  #
  # breakpoints can also return a value. They will execute
  # a supplied block for getting a default return value.
  # A custom value can be returned from the session by doing
  # +throw(:debug_return, value)+.
  #
  # You can also give names to break points which will be
  # used in the message that is displayed upon execution 
  # of them.
  #
  # Here's a sample of how breakpoints should be placed:
  #
  #   class Person
  #     def initialize(name, age)
  #       @name, @age = name, age
  #       breakpoint("Person#initialize")
  #     end
  #
  #     attr_reader :age
  #     def name
  #       breakpoint("Person#name") { @name }
  #     end
  #   end
  #
  #   person = Person.new("Random Person", 23)
  #   puts "Name: #{person.name}"
  #
  # And here is a sample debug session:
  #
  #   Executing break point "Person#initialize" at file.rb:4 in `initialize'
  #   irb(#<Person:0x292fbe8>):001:0> local_variables
  #   => ["name", "age", "_", "__"]
  #   irb(#<Person:0x292fbe8>):002:0> [name, age]
  #   => ["Random Person", 23]
  #   irb(#<Person:0x292fbe8>):003:0> [@name, @age]
  #   => ["Random Person", 23]
  #   irb(#<Person:0x292fbe8>):004:0> self
  #   => #<Person:0x292fbe8 @age=23, @name="Random Person">
  #   irb(#<Person:0x292fbe8>):005:0> @age += 1; self
  #   => #<Person:0x292fbe8 @age=24, @name="Random Person">
  #   irb(#<Person:0x292fbe8>):006:0> exit
  #   Executing break point "Person#name" at file.rb:9 in `name'
  #   irb(#<Person:0x292fbe8>):001:0> throw(:debug_return, "Overriden name")
  #   Name: Overriden name
  def breakpoint(id = nil, context = nil, &block)
    callstack = caller
    callstack.slice!(0, 3) if callstack.first["breakpoint"]
    file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures

    message = "Executing break point " + (id ? "#{id.inspect} " : "") +
              "at #{file}:#{line}" + (method ? " in `#{method}'" : "")

    if context then
      return handle_breakpoint(context, message, file, line, &block)
    end

    Binding.of_caller do |binding_context|
      handle_breakpoint(binding_context, message, file, line, &block)
    end
  end

  def handle_breakpoint(context, message, file = "", line = "", &block) # :nodoc:
    catch(:debug_return) do |value|
      eval(%{
        def self.source_lines(context = 5, return_line_numbers = false)
          lines = File.readlines(#{file.inspect}).map { |line| line.chomp }

          break_line = #{line}
          start_line = [break_line - context, 1].max
          end_line = break_line + context

          result = lines[(start_line - 1) .. (end_line - 1)]

          if return_line_numbers then
            return [start_line, break_line, result]
          else
            return result
          end
        end
      }, context) rescue nil

      if not use_drb? then
        puts message
        IRB.start(nil, IRB::WorkSpace.new(context))
      else
        @drb_service.add_breakpoint(context, message)
      end

      block.call if block
    end
  end
  private :handle_breakpoint

  # This asserts that the block evaluates to true.
  # If it doesn't evaluate to true a breakpoint will
  # automatically be created at that execution point.
  #
  # You can disable assert checking by setting 
  # Breakpoint.optimize_asserts to true before
  # loading the breakpoint.rb library. (It will still
  # be enabled when Ruby is run via the -d argument.)
  #
  # Example:
  #   person_name = "Foobar"
  #   assert { not person_name.nil? }
  def assert(context = nil, &condition)
    return if Breakpoint.optimize_asserts and not $DEBUG
    return if yield

    callstack = caller
    callstack.slice!(0, 3) if callstack.first["assert"]
    file, line, method = *callstack.first.match(/^(.+?):(\d+)(?::in `(.*?)')?/).captures

    message = "Assert failed at #{file}:#{line}#{" in `#{method}'" if method}. " +
              "Executing implicit breakpoint."

    if context then
      return handle_breakpoint(context, message, file, line)
    end

    Binding.of_caller do |context|
      handle_breakpoint(context, message, file, line)
    end
  end

  # Whether asserts should be ignored if not in debug mode.
  # Debug mode can be enabled by running ruby with the -d
  # switch or by setting $DEBUG to true.
  attr_accessor :optimize_asserts
  self.optimize_asserts = false

  class DRbService
    include DRbUndumped

    def initialize
      @handler = nil
      @at_exit = lambda { }

      IRB.instance_eval { @CONF[:RC] = true }
      IRB.run_config

      at_exit { @at_exit.call }
    end

    def add_breakpoint(context, message)
      workspace = IRB::WorkSpace.new(context)
      workspace.extend(DRbUndumped)

      until @handler; end
      @handler.call(workspace, message)
    end

    def register_handler(&block)
      @handler = block
    end

    def unregister_handler
      @handler = nil
    end

    def register_exit_handler(&block)
      @at_exit = block
    end

    def unregister_exit_handler
      @at_exit = lambda { }
    end
  end

  # Will run Breakpoint in DRb mode. This will spawn a server
  # that can be attached to via the breakpoint-client command
  # whenever a breakpoint is executed. This is useful when you
  # are debugging CGI applications or other applications where
  # you can't access debug sessions via the standard input and
  # output of your application.
  #
  # You can specify an URI where the DRb server will run at.
  # This way you can specify the port the server runs on. The
  # default URI is druby://localhost:42531.
  #
  # Please note that breakpoints will be skipped silently in
  # case the DRb server can not spawned. (This can happen if
  # the port is already used by another instance of your
  # application on CGI or another application.)
  #
  # Also note that by default this is not secure. You can
  # however specify a list of allowed hosts. But that will
  # still not protect you from somebody reading the data
  # as it goes through the net.
  #
  # A good approach for getting security is setting up an SSH
  # tunnel between the DRb service and the client. This is
  # usually done like this:
  #
  # $ ssh -L20000:127.0.0.1:20000 -R10000:127.0.0.1:10000 example.com
  # (This will connect port 20000 at the client side to port
  # 20000 at the server side, and port 10000 at the server
  # side to port 10000 at the client side.)
  #
  # After you have done that you should specify "localhost"
  # as the second argument to the +activate_drb()+ call.
  #
  # Running through such a SSH proxy will also let you use 
  # breakpoint.rb in case you are behind a firewall.
  #
  # Detailed information about running DRb through firewalls is
  # available at http://www.rubygarden.org/ruby?DrbTutorial
  def activate_drb(uri = 'druby://localhost:42531',
    allowed_hosts = nil)

    if allowed_hosts then
      acl = ["deny all"]

      Array(allowed_hosts).each do |host|
        acl << "allow #{host}"
      end

      DRb.install_acl(ACL.new(acl.join("\n")))
    end

    @use_drb = true
    @drb_service = DRbService.new
    DRb.start_service(uri, @drb_service)
  end

  def use_drb?
    @use_drb == true
  end
end

module IRB
  def IRB.start(ap_path = nil, main_context = nil, workspace = nil)
    $0 = File::basename(ap_path, ".rb") if ap_path

    # suppress some warnings about redefined constants
    old_verbose, $VERBOSE = $VERBOSE, nil
    IRB.setup(ap_path)
    $VERBOSE = old_verbose

    if @CONF[:SCRIPT] then
      irb = Irb.new(main_context, @CONF[:SCRIPT])
    else
      irb = Irb.new(main_context)
    end

    if workspace then
      irb.context.workspace = workspace
    end

    @CONF[:IRB_RC].call(irb.context) if @CONF[:IRB_RC]
    @CONF[:MAIN_CONTEXT] = irb.context

    trap("SIGINT") do
      irb.signal_handle
    end
    
    catch(:IRB_EXIT) do
      irb.eval_input
    end
  end

  class << self; alias :old_CurrentContext :CurrentContext; end
  def IRB.CurrentContext
    if old_CurrentContext.nil? and Breakpoint.use_drb? then
      result = Object.new
      def result.last_value; end
      return result
    else
      old_CurrentContext
    end
  end

  class Context
    alias :old_evaluate :evaluate
    def evaluate(line, line_no)
      if line.chomp == "exit" then
        exit
      else
        old_evaluate(line, line_no)
      end
    end
  end

  class WorkSpace
    alias :old_evaluate :evaluate

    def evaluate(*args)
      if Breakpoint.use_drb? then
        result = old_evaluate(*args)
        unless [true, false, nil].include?(result)
          result.extend(DRbUndumped) rescue nil
        end
        return result
      else
        old_evaluate(*args)
      end
    end
  end
end

class DRb::DRbObject
  undef :inspect
end

def breakpoint(id = nil, &block)
  Binding.of_caller do |context|
    Breakpoint.breakpoint(id, context, &block)
  end
end

def assert(&block)
  Binding.of_caller do |context|
    Breakpoint.assert(context, &block)
  end
end

In This Thread