[#163711] Re: [ANN] urirequire: I got yer Web 2.0 right here — "Daniel Sheppard" <daniels@...>

> if expected_digest

11 messages 2005/11/02

[#163730] ruby-dev summary 27393-27541 — Minero Aoki <aamine@...>

Hi all,

61 messages 2005/11/02
[#163734] Re: ruby-dev summary 27393-27541 — Christophe Grandsire <christophe.grandsire@...> 2005/11/02

Selon Minero Aoki <aamine@loveruby.net>:

[#163762] YACC (Was: Re: ruby-dev summary 27393-27541) — mental@... 2005/11/02

Quoting Christophe Grandsire <christophe.grandsire@free.fr>:

[#163736] Re: ruby-dev summary 27393-27541 — "David A. Black" <dblack@...> 2005/11/02

Hi --

[#163741] Re: ruby-dev summary 27393-27541 — nobuyoshi nakada <nobuyoshi.nakada@...> 2005/11/02

HI,

[#163818] Compiled version of Ruby — "zero" <web2ed@...>

I know this has been discussed before but I would like to know if

13 messages 2005/11/02

[#163865] Ruby On Rails Tutorials That Actually Work? — "Dale" <dmgreer@...>

This may not be the group to ask, if not pardon me. I've gone through three

10 messages 2005/11/03

[#163911] Ruby Certification — "Chintakrindi Meghanath" <Meghanath@...>

Hi

27 messages 2005/11/03

[#163955] Continous running thread — iamscottwalter@...

Hi,

16 messages 2005/11/03

[#164082] Some comments on new 1.9 features — "Trans" <transfire@...>

Just looking at http://eigenclass.org/hiki.rb?Changes+in+Ruby+1.9.

47 messages 2005/11/04
[#164217] Re: Some comments on new 1.9 features — "Domenico De Felice" <defelicedomenico@...> 2005/11/04

Nikolai Weibull wrote:

[#164104] i wanna get involved — Cam <cameron.matheson@...>

Hi,

13 messages 2005/11/04

[#164107] MS SQL Access from Ruby in Windows — Horacio Sanson <hsanson@...>

13 messages 2005/11/04

[#164187] Class and Mixin with same method name problem — petermichaux@...

Hi,

14 messages 2005/11/04

[#164195] Ruby making inroads at big corporation... small anecdote. — Stephen Waits <steve@...>

34 messages 2005/11/04
[#164239] Re: Ruby making inroads at big corporation... small anecdote. — James Britt <james_b@...> 2005/11/04

Stephen Waits wrote:

[#164420] can you recommend some easy ruby project for newbie? — nonocast <nonocast@...>

i am a ruby newbie

14 messages 2005/11/06

[#164450] what does --can't define singleton method-- mean? — Daniel Sche <uval@...>

RubyNG.hello /.*/

16 messages 2005/11/06

[#164456] Access control and class methods — Mads Kristensen <madsk@...>

Hi.

15 messages 2005/11/06

[#164472] rubyforge-0.0.0 — "Ara.T.Howard" <Ara.T.Howard@...>

12 messages 2005/11/06

[#164502] Lazy fun: Make unary minus silence stderr for backticks — Sam Stephenson <sstephenson@...>

I was reading about mentalguy's lazy.rb and thought it'd be fun to use

11 messages 2005/11/06

[#164529] programming best practices — swille <sillewille@...>

I have a couple of standard programming questions. The first is that

16 messages 2005/11/07

[#164658] Investigating Ruby - key limitations ? — "mortench" <mortench@...>

I have been looking at the Ruby programming language recently. I like

49 messages 2005/11/07
[#164794] Re: Investigating Ruby - key limitations ? — "mortench" <mortench@...> 2005/11/08

Thanks for all the replies. Since I can't possibly reply to all, I will

[#164728] which open source licence? — petermichaux@...

Hi,

20 messages 2005/11/08

[#164824] Checking for race conditions with Ruby threads — Wilson Bilkovich <wilsonb@...>

I've got an untrustworthy legacy app that seems to have a nasty race

11 messages 2005/11/08
[#164830] Re: Checking for race conditions with Ruby threads — mental@... 2005/11/08

Quoting Wilson Bilkovich <wilsonb@gmail.com>:

[#164881] Question about symbols — "Jacek Olszak" <jacekolszak@...2.pl>

Hi everyone...

15 messages 2005/11/08

[#164944] Equvialent of RoboCode and/or Terrarium for Ruby? — kheon@...

Just wondering if there is an equivalent to RoboCode (http://robocode.sourceforge.net/) or Terrarium (http://www.windowsforms.net/Applications/application.aspx?PageID=30&tabindex=8) currently available for Ruby.

9 messages 2005/11/09

[#164960] How to install something on MacOS X? — pete boardman <pete.boardman@...>

So far I've been learning Ruby (1.8.2 as pre-installed on Mac/Tiger)

13 messages 2005/11/09

[#164971] RUBY GRAMMAR — puellula@...

Hi!

31 messages 2005/11/09

[#165069] Red: The Ruby Journal, a professional periodical for Ruby developers — ruby.journal@...

I am pleased to pre-announce the launch of a new, professional

47 messages 2005/11/09
[#165094] Re: [ANN] Red: The Ruby Journal, a professional periodical for Ruby developers — Bill Guindon <agorilla@...> 2005/11/10

On 11/9/05, ruby.journal@mac.com <ruby.journal@mac.com> wrote:

[#165472] Re: [ANN] Red: The Ruby Journal, a professional periodical for Ruby developers — ruby.journal@... 2005/11/12

[#165473] Re: [ANN] Red: The Ruby Journal, a professional periodical for Ruby developers — Hal Fulton <hal9000@...> 2005/11/12

ruby.journal@mac.com wrote:

[#165162] Ruby - Newbie to Guru - Advice? — Sean Hussey <seanhussey@...>

Alright, I've been bitten by the Ruby bug, but I haven't yet had that

15 messages 2005/11/10

[#165218] Network computer name problem w/ Tiger and DRb — Jim Freeze <jim@...>

Hi

18 messages 2005/11/10
[#165220] Re: Network computer name problem w/ Tiger and DRb — Eric Hodel <drbrain@...7.net> 2005/11/10

On Nov 10, 2005, at 2:38 PM, Jim Freeze wrote:

[#165223] Re: Network computer name problem w/ Tiger and DRb — Jim Freeze <jim@...> 2005/11/10

On 11/10/05, Eric Hodel <drbrain@segment7.net> wrote:

[#165376] DocBook to PDF — Hal Fulton <hal9000@...>

I'm wanting to do some docbook to pdf conversion.

25 messages 2005/11/12

[#165379] Index and Query (#54) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

26 messages 2005/11/12
[#165777] Re: Index and Query (#54) — "Interfecus" <interfecus@...> 2005/11/14

Hi,

[#165787] Re: Index and Query (#54) — James Edward Gray II <james@...> 2005/11/15

On Nov 14, 2005, at 5:17 PM, Interfecus wrote:

[#165449] Converting between Time and DateTime — Lloyd Zusman <ljz@...>

What is the recommended method for converting between Time objects and

32 messages 2005/11/12
[#165450] Re: Converting between Time and DateTime — "David A. Black" <dblack@...> 2005/11/12

Hi --

[#165558] Re: Converting between Time and DateTime — Kirk Haines <khaines@...> 2005/11/13

On Saturday 12 November 2005 11:26 am, David A. Black wrote:

[#165726] Re: Converting between Time and DateTime — "Adam Sanderson" <netghost@...> 2005/11/14

Is there any reason to choose one over the other? At least for post

[#165595] Ruby Forum — Andreas Schwarz <f@...>

Hi,

56 messages 2005/11/13
[#165605] Re: [ANN] Ruby Forum — James Edward Gray II <james@...> 2005/11/14

On Nov 13, 2005, at 5:03 PM, Andreas Schwarz wrote:

[#165607] Re: Ruby Forum 2005/11/14

james wrote:

[#165614] Re: Ruby Forum — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/11/14

Toby DiPasquale wrote:

[#165597] Re: Equvialent of RoboCode and/or Terrarium for Ruby? — "Daniel Sheppard" <daniels@...>

17 messages 2005/11/13
[#165671] Re: Equvialent of RoboCode and/or Terrarium for Ruby? — "Dave Burt" <dave@...> 2005/11/14

Reyn Vlietstra mused:

[#165778] Re: Equvialent of RoboCode and/or Terrarium for Ruby? — "Kyle Heon" <kheon@...> 2005/11/14

Yes, and while this is basic in principle is really why it's such a great

[#165783] Re: Equvialent of RoboCode and/or Terrarium for Ruby? — Lyndon Samson <lyndon.samson@...> 2005/11/15

So, come on! Lets get a mailing list or some sort of forum set up to

[#165913] Re: Equvialent of RoboCode and/or Terrarium for Ruby? — "Adam Sanderson" <netghost@...> 2005/11/15

No way! Lets discuss the possibility of discussing this some more!

[#165656] Recursive functions — hans.sjunnesson@...

I know that this is a trivial problem, but I'm having a hard time

21 messages 2005/11/14

[#165755] removing a constant definition from an environment — Robert Evans <robert.evans@...>

Hi,

11 messages 2005/11/14
[#165757] Re: removing a constant definition from an environment — Ryan Leavengood <leavengood@...> 2005/11/14

On 11/14/05, Robert Evans <robert.evans@acm.org> wrote:

[#165760] Re: removing a constant definition from an environment — Robert Evans <robert.evans@...> 2005/11/14

Hi Ryan,

[#165764] Re: removing a constant definition from an environment — Mauricio Fern疣dez <mfp@...> 2005/11/14

On Tue, Nov 15, 2005 at 06:56:59AM +0900, Robert Evans wrote:

[#165935] DRb Crashing — James Edward Gray II <james@...>

If I launch this server:

18 messages 2005/11/15

[#166032] static variable; behaviour in ruby? — Hugh Sasse <hgs@...>

Any idea how to create or simulate a static variable in ruby?

15 messages 2005/11/16

[#166077] Proposed RCR: Object#replace — Austin Ziegler <halostatue@...>

On the Sydney list, Daniel Berger has been asking about a generic

24 messages 2005/11/16
[#166124] Re: Proposed RCR: Object#replace — Eric Mahurin <eric.mahurin@...> 2005/11/16

> class Object

[#166200] Keyword arguments like grandma makes 'em — "Trans" <transfire@...>

I'm messing around with some methods trying to figure out how to offer

14 messages 2005/11/17

[#166206] Time.yesterday ? :) — Marcin Jurczuk <mj-usunto@...>

Hello group.

16 messages 2005/11/17

[#166277] Ruby not commercial, right? — boscomonkey@...

I'm trying to organize a Ruby Meetup group in San Francisco

19 messages 2005/11/18
[#166300] Re: Ruby not commercial, right? — Mark Hubbart <discordantus@...> 2005/11/18

On 11/17/05, boscomonkey@gmail.com <boscomonkey@gmail.com> wrote:> I'm trying to organize a Ruby Meetup group in San Francisco> (http://ruby.meetup.com/6/) and applied to the SF Public Library to use> one of their small meeting rooms. They turned us down because they have> deemed Ruby to be a product for commercial gain. The analogy that the> SFPL contact person used is that one can walk into a bookstore and find> a book on Ruby; I countered that one can also find a book on> childrearing.>> The SFPL Meeting Room Community Use Rules (http://sfpl.org/libraryl> ocations/mtgrms/rules.htm) states [emphasis mine]:>> "No outside group or organization using a Library meeting room> shall: 1) charge an admission fee or solicit donations, 2) sell or> ***promote any material or service for private profit or gain***, 3)> engage in fund raising activities, (excepting those groups who have> contracted with the Library to do so in support of Library programs and> activities).">> I'm arguing that because Ruby is an Open Source project, there is no> private profit or gain when Ruby is utilized versus when another> programming language is utilized. As opposed to using Microsoft Excel> versus Lotus 1-2-3; in which case, Microsoft stands to make money from> Excel licenses.>> Can anyone think of better arguments? I think mine is a tad subtle for> non-computer people.

[#166452] web development w/ ruby — Cam <cameron.matheson@...>

Hi guys,

24 messages 2005/11/18
[#196269] Re: web development w/ ruby minus rails — rahul benegal <rahul_kumar@...> 2006/06/07

cameron.matheson wrote:

[#166457] Symbol#inspect bug? — "Dominik Bathon" <dbatml@...>

Hallo,

16 messages 2005/11/18
[#166495] Re: Symbol#inspect bug? — "Robert Klemme" <bob.news@...> 2005/11/19

Eric Mahurin <eric.mahurin@gmail.com> wrote:

[#166525] Re: Symbol#inspect bug? — Eric Mahurin <eric.mahurin@...> 2005/11/19

On 11/19/05, Robert Klemme <bob.news@gmx.net> wrote:

[#166532] Re: Symbol#inspect bug? — Mark Hubbart <discordantus@...> 2005/11/19

On 11/19/05, Eric Mahurin <eric.mahurin@gmail.com> wrote:> On 11/19/05, Robert Klemme <bob.news@gmx.net> wrote:> > > For many of the other core classes (and definitely all other immediate> > > classes), #inspect returns a representation that is eval'able to get> > > back an equivalent (or the same) object. When possible, I think that> > > is what #inspect should do. I think it is a bug that Symbol#inspect> > > almost does it, but not quite (quotes some cases but not others).> >> > Although I'd agree that Symbol#inspect can be improved and should be> > changend (as it's an easy fix) I have a different opinion about the usage of> > inspect in general: even inspect methods of core classes fail to return> > something that is proper ruby code.> >> > $ ruby -e 'p Object.new'> > #<Object:0x100f6b28>> > $ ruby -e 'a=[1];a<<a;p a'> > [1, [...]]>> I didn't say all core classes return something evalable for #inspect> (I said many). Here's the list I see:>> FalseClass, TrueClass, NilClass> Fixnum, Bignum> Float> String> Regexp> Symbol - close but no cigar> Class - kind of - it returns a constant for class that can be evaled> Array, Hash, Range - if no recursion and all elements have an evalable #inspect

[#166489] Best OS for Ruby Dev/Best OS for Ruby Hosting — "Rawn027" <Rawn027@...>

Which is the best OS to use for ruby development...My vote goes to Mac

22 messages 2005/11/19
[#166493] Re: Best OS for Ruby Dev/Best OS for Ruby Hosting — Mauricio Fern疣dez <mfp@...> 2005/11/19

On Sat, Nov 19, 2005 at 05:12:23PM +0900, Rawn027 wrote:

[#166498] Re: Best OS for Ruby Dev/Best OS for Ruby Hosting — Jacob Quinn Shenker <jqshenker@...> 2005/11/19

On 11/19/05, Mauricio Fern叩ndez <mfp@acm.org> wrote:> On Sat, Nov 19, 2005 at 05:12:23PM +0900, Rawn027 wrote:> > Which is the best OS to use for ruby development...My vote goes to Mac> > OS X?>> matz uses Debian ;-)

[#166505] Re: Best OS for Ruby Dev/Best OS for Ruby Hosting — Edwin van Leeuwen <edder@...> 2005/11/19

jqshenker wrote:

[#166745] Re: Best OS for Ruby Dev/Best OS for Ruby Hosting — Aaron Kulbe <akulbe@...> 2005/11/21

> Lots of people happen to like FreeBSD for its Ruby support. One of its> major system utilities, portupgrade, is written in Ruby, so that's one> neat aspect. I'd recommend staying away from Gentoo: I prefer> source-based OSs, but Gentoo just breaks too often for it to be worth> it. Also, Gentoo users are on the whole jerkyer and less helpful than> normal people.

[#166535] An alternative to Gems — "Trans" <transfire@...>

23 messages 2005/11/19
[#166557] Re: An alternative to Gems — Austin Ziegler <halostatue@...> 2005/11/19

On 11/19/05, Trans <transfire@gmail.com> wrote:

[#166625] Euchre Hands (#55) — Robin Stocker <robin@...>

Hi

29 messages 2005/11/20
[#166709] Re: [QUIZ SOLUTION] Euchre Hands (#55) — "Dominik Bathon" <dbatml@...> 2005/11/21

Here is my solution.

[#166714] Re: [QUIZ SOLUTION] Euchre Hands (#55) — "Dominik Bathon" <dbatml@...> 2005/11/21

Here is another solution to the problem. I got the idea for this while

[#166718] Re: [QUIZ SOLUTION] Euchre Hands (#55) — Zed Lopez <zed.lopez@...> 2005/11/21

On 11/20/05, Dominik Bathon <dbatml@gmx.de> wrote:

[#166729] Re: [QUIZ SOLUTION] Euchre Hands (#55) — "Dominik Bathon" <dbatml@...> 2005/11/21

On Mon, 21 Nov 2005 04:20:16 +0100, Zed Lopez <zed.lopez@gmail.com> wrote:

[#166733] Re: [QUIZ SOLUTION] Euchre Hands (#55) — Ryan Leavengood <leavengood@...> 2005/11/21

Thanks to inspiration from reading Zed Lopez's code, I've been able to

[#166651] Help requested: new book — "Mark Watson" <mark.watson@...>

I would appreciate some help defining the topics for a new free web

14 messages 2005/11/20

[#166706] Parsing excel CVS data on a mac OSX to extract blocks of cells — "anne001" <anne@...>

I would like to parse some excel CVS data which has a repetitive block

13 messages 2005/11/21

[#166720] Active Record without rails — Horacio Sanson <hsanson@...>

13 messages 2005/11/21

[#166759] url-monitoring script question — Torsten Schmidt <torstello@...>

Hi @all,

16 messages 2005/11/21

[#166796] fixrbconfig broken in 10.4.3 — "Rawn027" <Rawn027@...>

I get an error saying that ruby.h cannot be found please install dev

6 messages 2005/11/21
[#166980] Re: fixrbconfig broken in 10.4.3 — Michal Suchanek <hramrach@...> 2005/11/22

On 11/21/05, Rawn027 <Rawn027@gmail.com> wrote:> I get an error saying that ruby.h cannot be found please install dev> tools but i have dev tools installed and ruby.h is there when i use> locate. I have no idea how to fix this, did 10.4.3 fix the problems> previously there with 10.4's broken ruby? Can I compile my own and have> it work? Where can I go from here because I was told to use the ruby> howto on technoblog.

[#166984] Re: fixrbconfig broken in 10.4.3 — Dave Baldwin <dave.baldwin@3dlabs.com> 2005/11/22

[#166801] Regular Expressions and Ruby — George Lunsford <george.lunsford@...>

Hi, I'm new to the list and I hope this is the right place to ask the

17 messages 2005/11/21

[#166820] Trying to change my OS from Windows to Linux/Mac — "Sam Kong" <sam.s.kong@...>

Hello, Ruby people!

32 messages 2005/11/21

[#166897] How to upgrade to Ruby1.8-3? — Tony <nospam2@2nospam.com>

Hi, I already installed Ruby 1.8-2 but I'd like to upgrade to 1.8-3

11 messages 2005/11/22

[#167048] what is the ruby way to do this? — "ako..." <akonsu@...>

hello,

50 messages 2005/11/22
[#167050] Re: what is the ruby way to do this? — JB Eriksson <mrkode@...> 2005/11/22

On 11/22/05, ako... <akonsu@gmail.com> wrote:

[#167103] Re: what is the ruby way to do this? — Jeff Wood <jeff.darklight@...> 2005/11/23

I would do

[#167106] Re: what is the ruby way to do this? — "David A. Black" <dblack@...> 2005/11/23

Hi --

[#167051] How convert an integer to a bit array — Curt Hibbs <curt.hibbs@...>

Does anyone have a clever way to convert an integer to an array of bit

16 messages 2005/11/22

[#167089] String#to_rx ? — Alex Fenton <alex@...>

Possible RCR: would anyone else find this a useful addition to the core

35 messages 2005/11/22
[#167328] Re: String#to_rx ? — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/11/24

Alex Fenton wrote:

[#167549] Re: String#to_rx ? — Jeff Wood <jeff.darklight@...> 2005/11/26

I believe the Facets project already contains a method like this for String

[#167572] Re: String#to_rx ? — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/11/26

Jeff Wood wrote:

[#167625] Re: String#to_rx ? — "Trans" <transfire@...> 2005/11/26

nikolai,

[#167630] Re: String#to_rx ? — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/11/26

Trans wrote:

[#167632] Re: String#to_rx ? — Jeff Wood <jeff.darklight@...> 2005/11/27

How does this differ from embedding variables in regular expressions now with

[#167635] Re: String#to_rx ? — "Trans" <transfire@...> 2005/11/27

Jeff,

[#167638] Re: String#to_rx ? — Jeff Wood <jeff.darklight@...> 2005/11/27

I didn't want them to be ... I wanted the body of the string to be

[#167639] Re: String#to_rx ? — Jeff Wood <jeff.darklight@...> 2005/11/27

Although I am surprised there isn't a String#escape ( or maybe #escaped ) method

[#167651] Re: String#to_rx ? — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/11/27

Jeff Wood wrote:

[#167653] Re: String#to_rx ? — Jeff Wood <jeff.darklight@...> 2005/11/27

Yes I did read the original thread.

[#167656] Re: String#to_rx ? — Nikolai Weibull <mailing-lists.ruby-talk@...> 2005/11/27

Jeff Wood wrote:

[#167124] pattern: auto-running module init code — ptkwt@... (Phil Tomson)

13 messages 2005/11/23

[#167152] teaching ruby as cs intro? — Mike Schwab <michael.schwab@...>

My school teaches intro to programming with Java or C#, intro to cs

14 messages 2005/11/23

[#167184] Re: [BUG] string range membership — "Warren Brown" <warrenbrown@...>

Ara,

3 messages 2005/11/23
[#167200] Re: [BUG] string range membership — "Ara.T.Howard" <ara.t.howard@...> 2005/11/23

On Thu, 24 Nov 2005, Warren Brown wrote:

[#167219] Re: [BUG] string range membership — Mark Hubbart <discordantus@...> 2005/11/23

On 11/23/05, Ara.T.Howard <ara.t.howard@noaa.gov> wrote:> On Thu, 24 Nov 2005, Warren Brown wrote:>> >>> ruby -v -e "p(('1'..'10').to_a)"> >>> ruby 1.8.2 (2004-12-25) [i386-mswin32]> >>> ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]> >>>> >>> This shows a clear and unique mapping of the range> >>> '1'..'10' into a set of strings.> >>> >> but where do '01', '001', and '0001' go? they too,> >> are in the set of strings.> >> > You completely lost me there. '01' doesn't *go* anywhere. That> > string is not in the range '1'..'10', in the same way the 'x' is not in> > the range 'a'..'n'.>> says who? ;-) i may chose to define String#succ to do whatever i like -> including the values '01', '001', and '0001'.>> my point is simply that you seem to be merging the notion of ranges and sets.> the range abstract to_a is determined by only a few things>> - the start and end points>> - the succ method of the start value and each successive succ value> remember one could do this>> irb(main):003:0> class String; def succ; self == "1" ? 42 : super; end; end> => nil> irb(main):004:0> "1".succ> => 42>> - the spaceship operator for each succ value called against the endpoint>> because of this we cannot even safely call to_a on an arbitrary range., for instance>> irb(main):002:0> (42.0 .. 1.0).to_a> TypeError: can't iterate from Float> from (irb):2:in `each'> from (irb):2:in `to_a'> from (irb):2>>> in summary a range is nothing but a set of endpoints with some> abstract/duck-type-like methods that may or may not produce a set as a> __process__. note that the set produced is not part of the range itself and> can be dynamically altered or even be made to produce a different set each> time:>> harp:~ > cat a.rb> class Float> def succ> self + rand> end> end>> p((4.2 ... 42.0).to_a)>> harp:~ > ruby a.rb> [4.2, 4.60303889967309, 5.57983848378295, 6.19446672151043, 6.92731328072508, 7.40446684874589, 7.79202463038348, 8.67552806421286, 9.42821837951244, 10.1988047216007, 11.1116769865281, 11.6169205995556, 11.9975653524073, 12.2256247650959, 12.8874200335378, 13.1557666607712, 13.6470070004444, 14.2172959192607, 15.0882979655236, 15.3487930162798, 15.9791460692026, 16.4321713791994, 17.0903318945661, 17.2967949864209, 18.2400722395741, 18.7286500286255, 19.7174743954199, 20.4528553779707, 20.953553149678, 21.0415866875269, 21.2924876748544, 22.2378099442685, 23.0076932295775, 23.0941582708386, 23.4748092012559, 23.5515124737304, 24.3463511761819, 24.6901201768951, 25.2541406207396, 26.0256212044938, 26.843159468986, 26.9579528629072, 27.01297383827, 27.7250436963749, 27.9017308958297, 28.1100643283236, 28.4480522935525, 28.6197629801695, 29.3756706791326, 29.9897540116082, 30.0057580759777, 30.7085039121469, 30.7510332074171, 30.9096299847723, 30.9314941316772, 31.3964098461468, 31.7312966347497, 32.2153802510432, 32.619498970957, 32.9731525439908, 33.3765950052407, 34.3397676884718, 35.1641816525327, 35.4891756054474, 36.2408178073905, 36.8733362068042, 37.6251560883057, 37.8047618263845, 37.8828752584342, 38.2001976403303, 38.9255502197319, 39.8027872575378, 40.0416710479264, 40.9954826039753, 41.4534375661544]>>> > Don't let the fact that my example used strings that look like numbers> > confuse the issue. The issue is that a range of strings that can be> > converted into a finite set, has a method to test for membership in that> > range, that doesn't match values that are in the set. Wow, that sentence> > is even hard for *me* to follow.> >> > OK, let's take a different example to avoid all discussion of integers> > and various string representations of them.> >> >> ruby -v -e "p(('a'..'aa').to_a)"> > ruby 1.8.2 (2004-12-25) [i386-mswin32]> > ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n",> > "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "aa"]> >> > Here we have a string range that has 27 "members". Now:>> not quite - we have a string range that __produces__ 27 elements. it does not> 'have' or 'contain' them. it merely suggests this set as it's current thought> on what that set might be. this set definition may change - unlike the> endpoints of the range - and it is therefore not a property of the range.>> >> ruby -e "p(('a'..'aa').member?('a'))"> > true> >> ruby -e "p(('a'..'aa').member?('b'))"> > false> > ...> >> ruby -e "p(('a'..'aa').member?('z'))"> > false> >> ruby -e "p(('a'..'aa').member?('aa'))"> > true> >> > Can this really be called correct behavior of the member?() method? I> > can't see any tenable argument to say that it is.>> the definition of membership may rely on endpoints only. that explains it> perfectly.>> harp:~ > irb> irb(main):001:0> 'z' < 'aa'> => false>> ergo - not in the set. the confustion here is caused by exactly the reasons> i'm explaining - String#succ has been defined not to create a monotonically> increasing (<=>) sequence - but to produce the "next" string in an english> sense. this is very useful for auto-generating names>> irb(main):004:0> "z99".succ> => "aa00">> if this were a monotonically increasing set the output would be>> => "z9:">> but that sure isn't that useful - unless you want to try to use ranges as> sets.>> the secret here is simply re-define String#succ - not Range#member. if> String#succ did a simply addition using base 255 arith you'd be set.

[#167194] Re: [BUG] string range membership — "Warren Brown" <warrenbrown@...>

Matz,

17 messages 2005/11/23

[#167295] Pickaxe tutorial section missing info on writing to files — Greg Gibson <greggib@...>

The Pickaxe seems to be missing an example (or two) about how to write a

12 messages 2005/11/24
[#167313] Re: Pickaxe tutorial section missing info on writing to files — Damphyr <damphyr@...> 2005/11/24

Greg Gibson wrote:

[#167325] RRobots - ducks, armed and dangerous — Simon Krer <SimonKroeger@...>

RRobots v0.1

38 messages 2005/11/24
[#167334] Re: RRobots - ducks, armed and dangerous — Edwin van Leeuwen <edder@...> 2005/11/24

SimonKroeger wrote:

[#167337] Re: RRobots - ducks, armed and dangerous — Simon Kröger <SimonKroeger@...> 2005/11/24

Edwin van Leeuwen wrote:

[#167356] Legal symbol names and generics — John Lam <drjflam@...>

I've just started thinking about generics in my Ruby <=3D> CLR bridge. This=

21 messages 2005/11/24
[#167362] Re: Legal symbol names and generics — Marcin Mielżyński <lopexx@...> 2005/11/24

it is legal (just use another symbol construction literal):

[#167396] Mac OS X TK — "James Edward Gray II" <james@...>

Is it possible to get a pure aqua TK running through Ruby on Mac OS X?

29 messages 2005/11/24
[#167486] Re: Mac OS X TK — Logan Capaldo <logancapaldo@...> 2005/11/25

On 11/24/05, James Edward Gray II <james@grayproductions.net> wrote:

[#167494] Re: Mac OS X TK — James Edward Gray II <james@...> 2005/11/25

On Nov 25, 2005, at 10:03 AM, Logan Capaldo wrote:

[#167500] Re: Mac OS X TK — Michal Suchanek <hramrach@...> 2005/11/25

On 11/25/05, James Edward Gray II <james@grayproductions.net> wrote:> On Nov 25, 2005, at 10:03 AM, Logan Capaldo wrote:>> > If you use the apple installed ruby its all of> > require 'tk' # Aqua GUI -- done>> If you have X11 installed. I have this working now. Thanks.>> > This may even work with a ruby installed from source, because I> > believe the> > magic is actually in the Tcl/Tk libs, not ruby.>> I can't get my custom compiled Ruby to do the same. I'm seeing:>> $ ruby -r tk -e1> /usr/local/lib/ruby/1.8/tk.rb:7:in `require': No such file to load --> tcltklib (LoadError)> from /usr/local/lib/ruby/1.8/tk.rb:7>> If anyone knows what I'm doing wrong there, please let me know.

[#167502] Re: Mac OS X TK — James Edward Gray II <james@...> 2005/11/25

On Nov 25, 2005, at 10:32 AM, Michal Suchanek wrote:

[#167562] Re: Mac OS X TK — Hidetoshi NAGAI <nagai@...> 2005/11/26

From: James Edward Gray II <james@grayproductions.net>

[#167563] Re: Mac OS X TK — James Edward Gray II <james@...> 2005/11/26

On Nov 25, 2005, at 9:23 PM, Hidetoshi NAGAI wrote:

[#167568] Re: Mac OS X TK — Hidetoshi NAGAI <nagai@...> 2005/11/26

From: James Edward Gray II <james@grayproductions.net>

[#167589] Re: Mac OS X TK — James Edward Gray II <james@...> 2005/11/26

On Nov 26, 2005, at 12:23 AM, Hidetoshi NAGAI wrote:

[#167593] Re: Mac OS X TK — Hidetoshi NAGAI <nagai@...> 2005/11/26

From: James Edward Gray II <james@grayproductions.net>

[#167601] Re: Mac OS X TK — James Edward Gray II <james@...> 2005/11/26

On Nov 26, 2005, at 10:40 AM, Hidetoshi NAGAI wrote:

[#167640] Re: Mac OS X TK — Hidetoshi NAGAI <nagai@...> 2005/11/27

From: James Edward Gray II <james@grayproductions.net>

[#167679] Re: Mac OS X TK — James Edward Gray II <james@...> 2005/11/27

On Nov 26, 2005, at 7:30 PM, Hidetoshi NAGAI wrote:

[#167453] Faster way to pick the every other array member? — Damphyr <damphyr@...>

we have [1,2,3,4,5,6,7] and want [2,4,6]

18 messages 2005/11/25

[#167465] `finalize' method? — Daniel Schierbeck <daniel.schierbeck@...>

Yeah, it's me again, your friendly neighbourhood power-suggester!

20 messages 2005/11/25
[#167468] Re: `finalize' method? — Jim Weirich <jim-keyword-rforum.c88827@...> 2005/11/25

dasch wrote:

[#167551] How do two objects communicate? — "anne001" <anne@...>

I wrote a small program the procedural way, now I would like to write

22 messages 2005/11/26

[#167585] Nubish questions about syntax and gems — "Ross Bamford" <rosco@...>

Hi folks.

13 messages 2005/11/26

[#167622] Turing 0.0.7 && cry for help — Michal <lists+rubytalk@...>

Hello all,

28 messages 2005/11/26
[#167709] Re: [ANN] Turing 0.0.7 && cry for help — Tobias Luetke <tobias.luetke@...> 2005/11/27

Great work on the library!

[#167735] Re: [ANN] Turing 0.0.7 && cry for help — Michal <lists+rubytalk@...> 2005/11/28

Hi,

[#167746] Re: [ANN] Turing 0.0.7 && cry for help — Hugh Sasse <hgs@...> 2005/11/28

On Mon, 28 Nov 2005, Michal wrote:

[#167780] Re: [BUG] string range membership — "Warren Brown" <warrenbrown@...>

Matz,

20 messages 2005/11/28
[#167782] Re: [BUG] string range membership — Yukihiro Matsumoto <matz@...> 2005/11/28

Hi,

[#167786] building ruby for speed: wise or otherwise? — Hugh Sasse <hgs@...>

My active record based script is taking longer than I'd like.

33 messages 2005/11/28
[#167790] Re: building ruby for speed: wise or otherwise? — Joel VanderWerf <vjoel@...> 2005/11/28

Hugh Sasse wrote:

[#167848] Wizard quiz — Leslie Viljoen <leslie@...>

I have written a few text adventures in TADS, the Texts

24 messages 2005/11/28
[#167884] Re: Wizard quiz — James Edward Gray II <james@...> 2005/11/28

On Nov 28, 2005, at 2:10 PM, Leslie Viljoen wrote:

[#167854] Programming Newbie: Ruby or Java? — "Dab" <dabhar1959@...>

Thanks for looking!

60 messages 2005/11/28
[#167861] Re: Programming Newbie: Ruby or Java? — Lyle Johnson <lyle.johnson@...> 2005/11/28

On 11/28/05, Dab <dabhar1959@hotmail.com> wrote:

[#167864] Re: Programming Newbie: Ruby or Java? — Christian Leskowsky <christian.leskowsky@...> 2005/11/28

I'm not sure why you guys think Ruby is easier than Java from a "Learn It"

[#167936] Re: Programming Newbie: Ruby or Java? — "Isaac Gouy" <igouy@...> 2005/11/29

mental@rydia.net wrote:

[#167982] Re: Programming Newbie: Ruby or Java? — mental@... 2005/11/29

Quoting Isaac Gouy <igouy@yahoo.com>:

[#167998] Re: Programming Newbie: Ruby or Java? — Peter Hickman <peter@...> 2005/11/29

mental@rydia.net wrote:

[#168001] Re: Programming Newbie: Ruby or Java? — mental@... 2005/11/29

Quoting Peter Hickman <peter@semantico.com>:

[#167869] what to do, what to do.. — Dirk Meijer <hawkman.gelooft@...>

hi everyone!

15 messages 2005/11/28

[#167888] GUI IDE for Ruby — tony <L@...>

Hi all,

40 messages 2005/11/29
[#167892] Re: GUI IDE for Ruby — Joe Van Dyk <joevandyk@...> 2005/11/29

On 11/28/05, tony <L@l.com> wrote:

[#168029] Splitting a text file into sentences — "basi" <basi_lio@...>

Looking for ideas on how to split a text file into sentences. I see the

38 messages 2005/11/29
[#168038] Re: Splitting a text file into sentences — Matthew Smillie <M.B.Smillie@...> 2005/11/30

[#168043] Re: Splitting a text file into sentences — "Kevin Olbrich" <kevin.olbrich@...> 2005/11/30

Depending on the text you might be able to search for a period (or other

[#168089] Re: Splitting a text file into sentences — Austin Ziegler <halostatue@...> 2005/11/30

On 11/29/05, Kevin Olbrich <kevin.olbrich@duke.edu> wrote:

[#168112] Re: Splitting a text file into sentences — Jeffrey Schwab <jeff@...> 2005/11/30

Austin Ziegler wrote:

[#168127] Re: Splitting a text file into sentences — Austin Ziegler <halostatue@...> 2005/11/30

On 11/30/05, Jeffrey Schwab <jeff@schwabcenter.com> wrote:

[#168137] Re: Splitting a text file into sentences — Jeffrey Schwab <jeff@...> 2005/11/30

Austin Ziegler wrote:

[#168142] Re: Splitting a text file into sentences — Austin Ziegler <halostatue@...> 2005/11/30

On 11/30/05, Jeffrey Schwab <jeff@schwabcenter.com> wrote:> Austin Ziegler wrote:>> Then, quite honestly, you were taught wrong. I was taught to use>> double spaces with a typewriter or when using fixed-pitch fonts>> (although that was later, since most computers and printers didn't>> have reliable kerning routines until I was out of university).>> Ultimately, the use of double spaces after a period is wrong *even>> with fixed-pitch fonts*, but it was done to be clearer since the>> width of the em-space and an en-space on a typewriter with a>> Courier-like font is exactly the same. The two spaces *simulates* an>> em-space in a typeset piece of work. (And that is *fact*, not>> opinion.)

[#168113] Ruby Enterprise App Design Advice — "TeslaOMD" <teslaomd@...>

I was wondering if anyone could give me some advice/thoughts/input

12 messages 2005/11/30

[#168144] Dumb question: in documentation, why Object#method, and not Object.method ? — "Elf M. Sternberg" <elf@...>

I keep seeing this syntax in documentation: Object#method, but in actual

17 messages 2005/11/30

[#168170] Help constructing interesting hash? — "Chris McMahon" <christopher.mcmahon@...>

Suppose I have an array of arrays like

12 messages 2005/11/30

[#168175] Ruby, MySQL on WinXP? — "planetthoughtful" <planetthoughtful@...>

Hello All,

13 messages 2005/11/30

Re: Trapping errors.

From: Hugh Sasse <hgs@...>
Date: 2005-11-02 16:10:36 UTC
List: ruby-talk #163774
On Thu, 3 Nov 2005, Robert Klemme wrote:

> Hugh Sasse wrote:
> > I see my changes to fileutils are now in the Ruby CVS.
> > However, even with
> >   rescue Exception, SystemCallError => e
> > or
> >   rescue Exception, Errno::EACCES, Errno::EBUSY => e
> >
> > I still cannot trap this error.  From the call stack this part of
> > the code is being used, so why won't the error cause ruby to go back
> > up the callstack until it finds this rescue clause?
> 
> Maybe there's another rescue clause that is closer to the place where the
> exception is thrown...

But unless I have completely misunderstood the point of rescue, even
if that calls raise, the exception will still be caught by my
enclosing rescue.

neelix hgs 15 %> irb
irb(main):001:0> begin
irb(main):002:1*   begin
irb(main):003:2*     raise StandardError
irb(main):004:2>   rescue
irb(main):005:2>     raise
irb(main):006:2>   end
irb(main):007:1> rescue
irb(main):008:1>   puts "caught here"
irb(main):009:1> end
caught here
=> nil
irb(main):010:0>

So, if I'm doing
  rescue Exception => e 
how can Errno::EACCES or Errno::EBUSY get past that and crash out?
> 
>     robert
> 
> >
> >         Hugh
> >
> > On Tue, 1 Nov 2005, Hugh Sasse wrote:
> >
> >> On Tue, 1 Nov 2005, Robert Klemme wrote:
> >>
> >>> Hugh Sasse <hgs@dmu.ac.uk> wrote:
> >>>> begin
> >>>>  #...
> >>>> rescue => e
> >>>>  #...
> >>>> end
> >>>>
> >>>> will trap e if it is a StandardError.  SystemCallErrrors are
> >>>> supposed to handle Errorcodes from the OS.  All of these are
> >>>> subclasses of Exception.  So why do I get this failure under
> >>>> Cygwin:
> >>>>
> >>>> $ ruby BACKUP.RB "C:\\" "D:\\buzz_c"
> >>>> cp -rp C:\ D:\buzz_c
> >>>> /usr/lib/ruby/1.8/new_fileutils.rb:1251:in `initialize': Device or
> >>>> resource busy - C:\/WINDOWS/WIN386.SWP (Errno::EBUSY)
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:1251:in `copy_file'
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:1221:in `copy'
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:455:in `copy_entry'
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:1314:in `traverse'
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:453:in `copy_entry'
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:424:in `cp_r'
> >>>>        from /usr/lib/ruby/1.8/new_fileutils.rb:1385:in
> >>>>        `fu_each_src_dest' from
> >>>>        /usr/lib/ruby/1.8/new_fileutils.rb:1401:in
> >>>>        `fu_each_src_dest0' from
> >>>>        /usr/lib/ruby/1.8/new_fileutils.rb:1383:in
> >>>> `fu_each_src_dest' from /usr/lib/ruby/1.8/new_fileutils.rb:422:in
> >>>> `cp_r' from BACKUP.RB:27
> >>>>
> >>>> hgs@buzz ~/downloads
> >>>>
> >>>> when my modified FileUtils.cp_r has
> >>>>
> >>>> begin
> >>>>  copy_entry ...
> >>>> rescue Exception => e
> >>>>  logger.error("backup"){"Error was #{e}")
> >>>> end
> >>>>
> >>>> (essentially.  Theres a bit more to it than that, but the details
> >>>> shouldn't matter for my question.)  So why can't I rescue it?  (I'm
> >>>> trying to log, and skip files I can't backup so at least I get most
> >>>> of the files, and know which ones I have not.)
> >>>
> >>> Maybe it's in another thread.  Or your code is actually not between
> >>> "begin" and "rescue" but outside of that.
> >>
> >> there's no threading in there, and I'm pretty certain it is within
> >> that, because it is in the call to copy_entry
> >>
> >>>
> >>> Kind regards
> >>>
> >>>    robert
> >>>
> >>
> >> The modified fileutils is (heavily pruned) below
> >> I've changed cp_r.
> >>
> >>         Hugh
> >>
> >> #
> >> # = fileutils.rb
> >> #
> >> # Copyright (c) 2000-2005 Minero Aoki <aamine@loveruby.net>
> >> #
> >> # This program is free software.
> >> # You can distribute/modify this program under the same terms of
> >> ruby. #
> >> # == module FileUtils
> >> #
> >> # Namespace for several file utility methods for copying, moving,
> >> removing, etc. #
> >> # === Module Functions
> >> #
> >> #       [...]
> >> #   cp_r(src, dest, options) {|s,d,e|...}
> >> #   cp_r(list, dir, options) {|s,d,e|...}
> >> #       [...]
> >> #
> >> # The <tt>options</tt> parameter is a hash of options, taken from
> >> the list # <tt>:force</tt>, <tt>:noop</tt>, <tt>:preserve</tt>, and
> >> <tt>:verbose</tt>. # <tt>:noop</tt> means that no changes are made.
> >> The other two are obvious. # Each method documents the options that
> >> it honours. #
> >> # All methods that have the concept of a "source" file or directory
> >> can take # either one file or a list of files in that argument.  See
> >> the method # documentation for examples.
> >> #
> >> # There are some `low level' methods, which do not accept any option:
> >> #
> >> #   copy_entry(src, dest, preserve = false, dereference = false)
> >> #   copy_file(src, dest, preserve = false, dereference = true)
> >> #       [...]
> >> #
> >> # == module FileUtils::Verbose
> >> #
> >> # This module has all methods of FileUtils module, but it outputs
> >> messages # before acting.  This equates to passing the
> >> <tt>:verbose</tt> flag to methods # in FileUtils.
> >> #
> >> # == module FileUtils::NoWrite
> >> #
> >> # This module has all methods of FileUtils module, but never changes
> >> # files/directories.  This equates to passing the <tt>:noop</tt>
> >> flag to methods # in FileUtils.
> >> #
> >> # == module FileUtils::DryRun
> >> #
> >> # This module has all methods of FileUtils module, but never changes
> >> # files/directories.  This equates to passing the <tt>:noop</tt> and
> >> # <tt>:verbose</tt> flags to methods in FileUtils.
> >> #
> >>
> >> module FileUtils
> >>
> >>   def self.private_module_function(name)   #:nodoc:
> >>     module_function name
> >>     private_class_method name
> >>   end
> >>
> >>   # This hash table holds command options.
> >>   OPT_TABLE = {}   #:nodoc: internal use only
> >>
> >> #       [...]
> >>
> >>   def fu_mkdir(path, mode)   #:nodoc:
> >>     path = path.sub(%r</\z>, '')
> >>     if mode
> >>       Dir.mkdir path, mode
> >>       File.chmod mode, path
> >>     else
> >>       Dir.mkdir path
> >>     end
> >>   end
> >>   private_module_function :fu_mkdir
> >>
> >> #       [...]
> >>
> >>   #
> >>   # Options: preserve noop verbose dereference_root
> >>   #
> >>   # Copies +src+ to +dest+. If +src+ is a directory, this method
> >>   copies # all its contents recursively. If +dest+ is a directory,
> >>   copies # +src+ to +dest/src+.
> >>   #
> >>   # +src+ can be a list of files.
> >>   #
> >>   #   # Installing ruby library "mylib" under the site_ruby
> >>   #   FileUtils.rm_r site_ruby + '/mylib', :force
> >>   #   FileUtils.cp_r 'lib/', site_ruby + '/mylib'
> >>   #
> >>   #   # Examples of copying several files to target directory.
> >>   #   FileUtils.cp_r %w(mail.rb field.rb debug/), site_ruby +
> >>   '/tmail' #   FileUtils.cp_r Dir.glob('*.rb'),
> >>   '/home/aamine/lib/ruby', :noop => true, :verbose => true #
> >>   #   # If you want to copy all contents of a directory instead of
> >>   the #   # directory itself, c.f. src/x -> dest/x, src/y -> dest/y,
> >>   #   # use following code.
> >>   #   FileUtils.cp_r 'src/.', 'dest'     # cp_r('src', 'dest') makes
> >>   src/dest, #                                      # but this
> >>   doesn't. #
> >>   def cp_r(src, dest, options = {})
> >>     fu_check_options options, :preserve, :noop, :verbose,
> >>     :dereference_root fu_output_message "cp -r#{options[:preserve] ?
> >>     'p' : ''} #{[src,dest].flatten.join ' '}" if options[:verbose]
> >>     return if options[:noop] options[:dereference_root] = true
> >>     unless options.key?(:dereference_root) fu_each_src_dest(src,
> >>       dest) do |s, d| begin
> >>         copy_entry s, d, options[:preserve],
> >>       options[:dereference_root] rescue Exception => e
> >>         stop = true
> >>         if block_given?
> >>           stop = yield s,d,e
> >>         end
> >>         raise if stop
> >>       end
> >>     end
> >>   end
> >>   module_function :cp_r
> >>
> >>   OPT_TABLE['cp_r'] = %w( noop verbose preserve dereference_root )
> >>
> >>   #
> >>   # Copies a file system entry +src+ to +dest+.
> >>   # If +src+ is a directory, this method copies its contents
> >>   recursively. # This method preserves file types, c.f. symlink,
> >>   directory... # (FIFO, device files and etc. are not supported yet)
> >>   #
> >>   # Both of +src+ and +dest+ must be a path name.
> >>   # +src+ must exist, +dest+ must not exist.
> >>   #
> >>   # If +preserve+ is true, this method preserves owner, group,
> >>   permissions # and modified time.
> >>   #
> >>   # If +dereference_root+ is true, this method dereference tree root.
> >>   #
> >>   def copy_entry(src, dest, preserve = false, dereference_root =
> >>     false) Entry_.new(src, nil, dereference_root).traverse do |ent|
> >>       destent = Entry_.new(dest, ent.rel, false)
> >>       ent.copy destent.path
> >>       ent.copy_metadata destent.path if preserve
> >>     end
> >>   end
> >>   module_function :copy_entry
> >>
> >>   #
> >>   # Copies file contents of +src+ to +dest+.
> >>   # Both of +src+ and +dest+ must be a path name.
> >>   #
> >>   def copy_file(src, dest, preserve = false, dereference = true)
> >>     ent = Entry_.new(src, nil, dereference)
> >>     ent.copy_file dest
> >>     ent.copy_metadata dest if preserve
> >>   end
> >>   module_function :copy_file
> >>
> >> #       [...]
> >>
> >>
> >>   class Entry_   #:nodoc: internal use only
> >>     include StreamUtils_
> >>
> >>     def initialize(a, b = nil, deref = false)
> >>       @prefix = @rel = @path = nil
> >>       if b
> >>         @prefix = a
> >>         @rel = b
> >>       else
> >>         @path = a
> >>       end
> >>       @deref = deref
> >>       @stat = nil
> >>       @lstat = nil
> >>     end
> >>
> >>     def inspect
> >>       "\#<#{self.class} #{path()}>"
> >>     end
> >>
> >>     def path
> >>       if @path
> >>         @path.to_str
> >>       else
> >>         join(@prefix, @rel)
> >>       end
> >>     end
> >>
> >>     def prefix
> >>       @prefix || @path
> >>     end
> >>
> >>     def rel
> >>       @rel
> >>     end
> >>
> >>     def dereference?
> >>       @deref
> >>     end
> >>
> >>     def exist?
> >>       lstat! ? true : false
> >>     end
> >>
> >>     def file?
> >>       s = lstat!
> >>       s and s.file?
> >>     end
> >>
> >>     def directory?
> >>       s = lstat!
> >>       s and s.directory?
> >>     end
> >>
> >>     def symlink?
> >>       s = lstat!
> >>       s and s.symlink?
> >>     end
> >>
> >>     def chardev?
> >>       s = lstat!
> >>       s and s.chardev?
> >>     end
> >>
> >>     def blockdev?
> >>       s = lstat!
> >>       s and s.blockdev?
> >>     end
> >>
> >>     def socket?
> >>       s = lstat!
> >>       s and s.socket?
> >>     end
> >>
> >>     def pipe?
> >>       s = lstat!
> >>       s and s.pipe?
> >>     end
> >>
> >>     S_IF_DOOR = 0xD000
> >>
> >>     def door?
> >>       s = lstat!
> >>       s and (s.mode & 0xF000 == S_IF_DOOR)
> >>     end
> >>
> >>     def entries
> >>       Dir.entries(path())\
> >>           .reject {|n| n == '.' or n == '..' }\
> >>           .map {|n| Entry_.new(prefix(), join(rel(), n.untaint)) }
> >>     end
> >>
> >>     def stat
> >>       return @stat if @stat
> >>       if lstat() and lstat().symlink?
> >>         @stat = File.stat(path())
> >>       else
> >>         @stat = lstat()
> >>       end
> >>       @stat
> >>     end
> >>
> >>     def stat!
> >>       return @stat if @stat
> >>       if lstat! and lstat!.symlink?
> >>         @stat = File.stat(path())
> >>       else
> >>         @stat = lstat!
> >>       end
> >>       @stat
> >>     rescue SystemCallError
> >>       nil
> >>     end
> >>
> >>     def lstat
> >>       if dereference?
> >>         @lstat ||= File.stat(path())
> >>       else
> >>         @lstat ||= File.lstat(path())
> >>       end
> >>     end
> >>
> >>     def lstat!
> >>       lstat()
> >>     rescue SystemCallError
> >>       nil
> >>     end
> >>
> >>     def chmod(mode)
> >>       if symlink?
> >>         File.lchmod mode, path() if have_lchmod?
> >>       else
> >>         File.chmod mode, path()
> >>       end
> >>     end
> >>
> >>     def chown(uid, gid)
> >>       if symlink?
> >>         File.lchown uid, gid, path() if have_lchown?
> >>       else
> >>         File.chown uid, gid, path()
> >>       end
> >>     end
> >>
> >>     def copy(dest)
> >>       case
> >>       when file?
> >>         copy_file dest
> >>       when directory?
> >>         begin
> >>           Dir.mkdir dest
> >>         rescue
> >>           raise unless File.directory?(dest)
> >>         end
> >>       when symlink?
> >>         File.symlink File.readlink(path()), dest
> >>       when chardev?
> >>         raise "cannot handle device file" unless
> >>         File.respond_to?(:mknod) mknod dest, ?c, 0666, lstat().rdev
> >>       when blockdev?
> >>         raise "cannot handle device file" unless
> >>         File.respond_to?(:mknod) mknod dest, ?b, 0666, lstat().rdev
> >>       when socket?
> >>         raise "cannot handle socket" unless File.respond_to?(:mknod)
> >>         mknod dest, nil, lstat().mode, 0
> >>       when pipe?
> >>         raise "cannot handle FIFO" unless File.respond_to?(:mkfifo)
> >>         mkfifo dest, 0666
> >>       when door?
> >>         raise "cannot handle door: #{path()}"
> >>       else
> >>         raise "unknown file type: #{path()}"
> >>       end
> >>     end
> >>
> >>     def copy_file(dest)
> >>       st = stat()
> >>       File.open(path(),  'rb') {|r|
> >>         File.open(dest, 'wb', st.mode) {|w|
> >>           fu_copy_stream0 r, w, (fu_blksize(st) ||
> >>         fu_default_blksize()) }
> >>       }
> >>     end
> >>
> >>     def copy_metadata(path)
> >>       st = lstat()
> >>       File.utime st.atime, st.mtime, path
> >>       begin
> >>         File.chown st.uid, st.gid, path
> >>       rescue Errno::EPERM
> >>         # clear setuid/setgid
> >>         File.chmod st.mode & 01777, path
> >>       else
> >>         File.chmod st.mode, path
> >>       end
> >>     end
> >>
> >> #       [...]
> >>
> >>     def platform_support
> >>       return yield unless fu_windows?
> >>       first_time_p = true
> >>       begin
> >>         yield
> >>       rescue Errno::ENOENT
> >>         raise
> >>       rescue => err
> >>         if first_time_p
> >>           first_time_p = false
> >>           begin
> >>             File.chmod 0700, path()   # Windows does not have symlink
> >>             retry
> >>           rescue SystemCallError
> >>           end
> >>         end
> >>         raise err
> >>       end
> >>     end
> >>
> >>     def preorder_traverse
> >>       stack = [self]
> >>       while ent = stack.pop
> >>         yield ent
> >>         stack.concat ent.entries.reverse if ent.directory?
> >>       end
> >>     end
> >>
> >>     alias traverse preorder_traverse
> >>
> >>     def postorder_traverse
> >>       if directory?
> >>         entries().each do |ent|
> >>           ent.postorder_traverse do |e|
> >>             yield e
> >>           end
> >>         end
> >>       end
> >>       yield self
> >>     end
> >>
> >>
> >> #       [...]
> >>
> >>     def join(dir, base)
> >>       return dir.to_str if not base or base == '.'
> >>       return base.to_str if not dir or dir == '.'
> >>       File.join(dir, base)
> >>     end
> >>   end   # class Entry_
> >>
> >>   def fu_list(arg)   #:nodoc:
> >>     [arg].flatten.map {|path| path.to_str }
> >>   end
> >>   private_module_function :fu_list
> >>
> >>   def fu_each_src_dest(src, dest)   #:nodoc:
> >>     fu_each_src_dest0(src, dest) do |s, d|
> >>       raise ArgumentError, "same file: #{s} and #{d}" if fu_same?(s,
> >>       d) yield s, d
> >>     end
> >>   end
> >>   private_module_function :fu_each_src_dest
> >>
> >>   def fu_each_src_dest0(src, dest)   #:nodoc:
> >>     if src.is_a?(Array)
> >>       src.each do |s|
> >>         s = s.to_str
> >>         yield s, File.join(dest, File.basename(s))
> >>       end
> >>     else
> >>       src = src.to_str
> >>       if File.directory?(dest)
> >>         yield src, File.join(dest, File.basename(src))
> >>       else
> >>         yield src, dest.to_str
> >>       end
> >>     end
> >>   end
> >>   private_module_function :fu_each_src_dest0
> >>
> >>   def fu_same?(a, b)   #:nodoc:
> >>     if fu_have_st_ino?
> >>       st1 = File.stat(a)
> >>       st2 = File.stat(b)
> >>       st1.dev == st2.dev and st1.ino == st2.ino
> >>     else
> >>       File.expand_path(a) == File.expand_path(b)
> >>     end
> >>   rescue Errno::ENOENT
> >>     return false
> >>   end
> >>   private_module_function :fu_same?
> >>
> >>   def fu_have_st_ino?   #:nodoc:
> >>     not fu_windows?
> >>   end
> >>   private_module_function :fu_have_st_ino?
> >>
> >>   def fu_check_options(options, *optdecl)   #:nodoc:
> >>     h = options.dup
> >>     optdecl.each do |name|
> >>       h.delete name
> >>     end
> >>     raise ArgumentError, "no such option: #{h.keys.join(' ')}"
> >>   unless h.empty? end
> >>   private_module_function :fu_check_options
> >>
> >>   def fu_update_option(args, new)   #:nodoc:
> >>     if args.last.is_a?(Hash)
> >>       args[-1] = args.last.dup.update(new)
> >>     else
> >>       args.push new
> >>     end
> >>     args
> >>   end
> >>   private_module_function :fu_update_option
> >>
> >>   @fileutils_output = $stderr
> >>   @fileutils_label  = ''
> >>
> >>   def fu_output_message(msg)   #:nodoc:
> >>     @fileutils_output ||= $stderr
> >>     @fileutils_label  ||= ''
> >>     @fileutils_output.puts @fileutils_label + msg
> >>   end
> >>   private_module_function :fu_output_message
> >>
> >>   #
> >>   # Returns an Array of method names which have any options.
> >>   #
> >>   #   p FileUtils.commands  #=> ["chmod", "cp", "cp_r", "install",
> >>   ...] #
> >>   def FileUtils.commands
> >>     OPT_TABLE.keys
> >>   end
> >>
> >>   #
> >>   # Returns an Array of option names.
> >>   #
> >>   #   p FileUtils.options  #=> ["noop", "force", "verbose",
> >>   "preserve", "mode"] #
> >>   def FileUtils.options
> >>     OPT_TABLE.values.flatten.uniq
> >>   end
> >>
> >>   #
> >>   # Returns true if the method +mid+ have an option +opt+.
> >>   #
> >>   #   p FileUtils.have_option?(:cp, :noop)     #=> true
> >>   #   p FileUtils.have_option?(:rm, :force)    #=> true
> >>   #   p FileUtils.have_option?(:rm, :perserve) #=> false
> >>   #
> >>   def FileUtils.have_option?(mid, opt)
> >>     li = OPT_TABLE[mid.to_s] or raise ArgumentError, "no such
> >>     method: #{mid}" li.include?(opt.to_s)
> >>   end
> >>
> >>   #
> >>   # Returns an Array of option names of the method +mid+.
> >>   #
> >>   #   p FileUtils.options(:rm)  #=> ["noop", "verbose", "force"]
> >>   #
> >>   def FileUtils.options_of(mid)
> >>     OPT_TABLE[mid.to_s]
> >>   end
> >>
> >> #       [...]
> >>
> >> end
> 
> 
> 


In This Thread