381125-381877

380979-382525 subjects 381362-383487

String.gsub with regex and block
381125 [axyd80@gm il] Probably a stupid question, but is there a way to use :gsub replacement
+ 381127 [Reid.Thompso] is it a requirement that you use gsub?
| 381138 [code@ap th o] This solution is not very generalizable.  It only works as presented for
| 381181 [b.candler@po] Yes, ruby 1.9 has named capture groups. I posted an example earlier in
+ 381129 [b.candler@po] There is also $~ (Regexp.last_match); $1/$2/etc are just a facade.
| 381142 [bbxx789_05ss] str = "John Smith"
+ 381131 [b.candler@po] Or if you are a ruby 1.9 user, you could use named capture groups
+ 381140 [bbxx789_05ss] Where are you replacing anything?
| 381144 [cmdjackryan@] irb(main):001:0> "John;Smith".scan /\S+/ do |match|
+ 381148 [jakekaiden@y] i also wonder if gsub is necessary...  there's no replacement here as
| 381170 [sergey.avsey] name, family, =3D arr
+ 381192 [axyd80@gm il] Thanks for advices, I didn't know about $~ containting arrays of

newlines in array problem
381134 [cyril_jose@y] Is there a way to get rid of newlines in an array?
+ 381135 [michel@de az] use 'collect'
+ 381137 [jgabrielygal] String#delete returns a copy of the string, it doesn't modify it in
+ 381139 [cyril_jose@y] Thanks Jesus - exactly what I needed.
+ 381143 [bbxx789_05ss] each() doesn't create a new array.  Why not use map()?  And you need to
  381146 [jgabrielygal] to
  381151 [bbxx789_05ss] "careful" meaning, "Dear op, you don't want to do that".

REXML Speed Question
381164 [haebooty@ya ] and I am having an issue with the amount of time it is taking.  If I
+ 381168 [ryand-ruby@z] Switch to nokogiri and you'll be much much happier.
+ 381169 [mark@wi ho t] For larger XML documents SAX parsing can really improve performance
+ 381173 [haebooty@ya ] Thanks for the info.  I am going to try Nokogiri, if I can only figure

reading and writing to child process with streams in ruby
381165 [mpurdy1973us] i am trying to fork a process to run a simple script which requires a
+ 381184 [nobuoka@r- e] Using IO#readpartial [1] instead of IO#read, you'll see the ruby
| 381236 [mpurdy1973us] thanx that did work; however, i after doing more research i agree this
+ 381198 [b.candler@po] You are sending just "username: " without a trailing newline.
  381238 [mpurdy1973us] (note: this is just to have an example for myself and team; we will

Sum of arrays getting slower as size increments
381174 [vbosch@gm il] I am currently doing some code for a face detection algorithm. In order =
+ 381176 [vbosch@gm il] After some much needed coffee  :-)   I changed from=20
+ 381177 [jgabrielygal] The problem is that b += array is the same as b = b + array, which
  + 381178 [vbosch@gm il] Thanks Jes=FAs!!
  + 381179 [vbosch@gm il] Your solution is much better than mine with << as that just adds the =

How do I trap Ctrl-C so it doesn't reach spawned threads?
381183 [jens.carlber] I'm having trouble trapping Ctrl-C. I have a CLI that spawns processes I wo=
+ 381200 [b.candler@po] Try replacing
+ 381266 [headius@he d] In MRI, I *believe* SIGINT is sent to the process that currently
  381517 [jens.carlber] charset="us-ascii"
  381877 [headius@he d] At this point you might want to take this to a JRuby bug

"of" keyword? inverse dot syntax...
381185 [julian@co et] some_data.to_s.split("\n").each{|item| puts item}
+ 381194 [josh.cheek@g] I don't think my brain would be very fond of this, I like starting with the
+ 381214 [ryand-ruby@z] of this_school
  + 381235 [vmanis@te us] ...
  + 381255 [ymendel@po o] AppleScript was my first thought, and this "of" stuff is quite

DSL 2011 - Last CFP
381188 [emilie.balla] ...

How to know whether current Fiber is the root Fiber?
381191 [ibc@al ax ne] can't yield from root fiber (FiberError)
381211 [bbxx789_05ss] How about catching the exception?
381212 [bbxx789_05ss] require 'fiber'
381276 [ibc@al ax ne] Great solution :)
381278 [shortcutter@] You could even use #equal? instead of #eql? just in case #eql? is overridde=

Checkinstall fails to create a Ruby 1.9.2 package
381193 [shamaoke@ho ] Checkinstall fails to create a Ruby 1.9.2 package. It returns the
+ 381202 [kbloom@gm il] Just install Debian's ruby1.9.1 package, which is really ruby 1.9.2.
+ 381203 [shamaoke@ho ] The patch level is different. It's critical for some applications.
| + 381204 [ibc@al ax ne] Iaki Baz Castillo
| + 381219 [kbloom@gm il] Well, then do the update the right way, namely
+ 381207 [shamaoke@ho ] I think, I have to avail myself of your advise.

Thor gem: how to display a USAGE: banner when passing in 0 arguments
381201 [klauer@gm il] So I can't find any good place to post this question, unless I'm filing it
381389 [klauer@gm il] Okay, so it's not really explained in the README, but it's in the docs.  I'm

(none)
381209 [badlands_200] ...

Calling to_enum on a MatchData object
381210 [vahagnh@gm i] def x
+ 381215 [bbxx789_05ss] to_enum() is defined in Object, and all classes inherit from Object.
+ 381216 [bbxx789_05ss] By the way, one way to get a handle on which instance methods a class
+ 381230 [bbxx789_05ss] You also might want to use the synonym enum_for() instead of to_enum(),
+ 381245 [vahagnh@gm i] Thank you for your explanations, I can see now that :each is an
| + 381247 [bbxx789_05ss] I'm not sure what you are referring to because each() is neither defined
| | 381411 [vahagnh@gm i] Sorry - I meant to say "enum_for / to_enum" was inherited and had to be
| + 381249 [gwtmp01@ma .] You are doing lots of unnecessary work there.  Since MatchData#captures
|   381254 [bbxx789_05ss] Posted via http://www.ruby-forum.com/.
|   381413 [vahagnh@gm i] Exactly - that was just to get proof of Enumerator working. In my
|   381498 [gwtmp01@ma .] OK.  I guess I didn't read closely enough.
+ 381248 [bbxx789_05ss] Here's how you can use an enumerator to create an infinite array, from
  381412 [vahagnh@gm i] I just tried out (0..9).cycle {|n| puts n} in an irb session and had to
  381414 [shortcutter@] The logic is a bit tricky. :-)  The Enumerator::Generator is just
  381539 [vahagnh@gm i] e = Enumerator.new do |y|

Java and Ruby integration
381220 [diegonakamas] What is the better way to integrate java and ruby?
+ 381222 [code@ap th o] Define "integrate Java and Ruby", please.  Are you talking about writing
+ 381223 [blowmage@gm ] You may want to take a look at protocol buffers. Pat Eyler has been blogging
+ 381224 [wyhaines@gm ] JRuby.
+ 381226 [klauer@gm il] Without knowing more about what level of integration you're trying to get,

[ANN] test-loop 10.0.1
381221 [sunaku@gm il] test-loop - Continuous testing for Ruby with fork/eval

to_yaml in utf-8 encoding
381227 [axyd80@gm il] Is there a way to force utf-8 encoding in to_yaml, ruby 1.9?
+ 381234 [bbxx789_05ss] The yaml docs for ruby 1.9.2  do not list a to_yaml() method.   And I
+ 381237 [bbxx789_05ss] # encoding: UTF-8
| 381240 [bbxx789_05ss] Posted via http://www.ruby-forum.com/.
+ 381241 [axyd80@gm il] Thanks for Your help,
+ 381242 [axyd80@gm il] require 'iconv'
+ 381243 [axyd80@gm il] $ brew install libyaml
  381260 [koulikoff@gm] Try ya2yaml

devkit not able to find ruby installation
381231 [javadba@gm i] As mentioned in title, devkit is not finding ruby installation. Also
+ 381239 [klauer@gm il] Not sure if it will solve your problem, but could you try putting a '-
+ 381246 [luislavena@g] As indicated in the example, you need to provide a list of

private vs. protected question
381244 [sbstn26@ya o] class Person
+ 381250 [bbxx789_05ss] class Dog
| 381251 [bbxx789_05ss] class Animal
+ 381253 [bbxx789_05ss] You can call private methods from inside public methods.

Released Watir 1.8.1
381262 [jarmo.p@gm i] Just released Watir 1.8.1!

File.open very basic
381268 [brett.a.krug] 'Beginning Ruby' by Peter Cooper
+ 381270 [nruska@gm il] Is your text source in the same directory as the ruby file you're running?
+ 381271 [jakekaiden@y] very strange...  what version of ruby are you running?  this code
+ 381272 [brett.a.krug] Ya I'm quite stumped as to what the problem could be. text.txt is
+ 381273 [brett.a.krug] So I found a strange solution -
| 381280 [josh.cheek@g] Maybe your text editor doesn't run it from the same location the files are
+ 381292 [albertschlef] puts "Last modified:", File.mtime("text.txt")

Have a nice day.
381275 [eaglebalti@g] Sale Sale Sale. Just visit the following link to buy computer

Copying parameters to singleton class
381281 [lasso@la so ] I have a metaprogramming question that is driving me mad. I though I
+ 381283 [shortcutter@] class Opportunities
| + 381319 [bbxx789_05ss] Hey Robert K,
| | + 381320 [bbxx789_05ss] In hindsight, I guess that wouldn't work if Opportunities is an existing
| | + 381327 [shortcutter@] Well, basically you just exchanged Opportunities with ClassFactory
| |   381368 [bbxx789_05ss] Yes, that's true.
| + 381382 [bbxx789_05ss] def self.using(opts)
+ 381284 [jgabrielygal] If you don't want instances of Opportunities, of which class you want insta=
| 381286 [lasso@la so ] On 11 Apr, 11:36, Jes=FAs Gabriel y Gal=E1n <jgabrielyga...@gmail.com>
+ 381321 [bbxx789_05ss] module ClassFactory
| 381328 [shortcutter@] I think we can do this simpler if you want to reuse that options
| + 381334 [lasso@la so ] ractices.com/
| | + 381336 [shortcutter@] Fine!  (Btw, which one did you pick?)
| | + 381367 [bbxx789_05ss] class Object
| |   381369 [bbxx789_05ss] ...actually, class << singleton puts us in the singleton class of
| + 381370 [bbxx789_05ss] I figured out the problem after I posted--including the module
+ 381383 [bbxx789_05ss] class <<singleton
| 381407 [lasso@la so ] I'm happy to see that is was possible to do this in so many ways :)
+ 381481 [bbxx789_05ss] Too many variables named 'options'!
+ 381483 [bbxx789_05ss] def using(new_options)
  381484 [bbxx789_05ss] prog.rb:18:in `[]=': can't modify frozen hash (RuntimeError)
  381520 [lasso@la so ] Even though I agress that using the same name for both the local
  381545 [bbxx789_05ss] There's working code, and there's clear code.  The goal: working code

Beginner's Beginner
381282 [wanelson23@g] I am trying to execute the Sudoku Solver listed in the book "The Ruby
+ 381287 [gerard.cahil] By requiring Sudoku, you're loading the contents of the file sudoku.rb which
| 381288 [cmdjackryan@] Ruby 1.9 expects* you to use
| 381290 [albertschlef] My Ruby 1.9 doesn't have a "require_relative" method.
| + 381296 [cmdjackryan@] Mine does.
| + 381299 [josh.cheek@g] require "#{File.dirname __FILE__}/path/to/file_sans_rb"
+ 381305 [bbxx789_05ss] When you require() a file, ruby looks in some default directories for
  381309 [bbxx789_05ss] $LOAD_PATH is an array, and the << is like calling push() on an

Ruby 1.9.2 difference newbie question
381300 [railsfid@gm ] Is there a difference between ruby 1.9.2 and ruby 1.9.2dev? and if so =

[ANN] Goliath v0.9.1 released
381303 [dj2@ev rb rn] I'm pleased to announce that Goliath v0.9.1 has been pushed out.

Creating a full application with Ruby
381306 [fs_tigre@ho ] I have a desk-top application that I created using Actionscript 3.0 and
+ 381310 [bbxx789_05ss] The creators of the application Ruby on Rails would disagree with you.
+ 381315 [jakekaiden@y] this looks like something you could do relatively easily with ruby -
+ 381318 [fs_tigre@ho ] Thank you all for your reply.
| + 381340 [jakekaiden@y] simple animations are easy with gtk2...
| | 381345 [ashbbb@gm il] If you like both gtk2 and Shoes, how about Green Shoes? ;-)
| | 381348 [jakekaiden@y] i'll give it a look - thanks...
| + 381343 [ashbbb@gm il] How about the Shoes manual?
+ 381349 [fs_tigre@ho ] I was reading the documentation from the Shoes' website and it looks
| 381371 [bbxx789_05ss] Please point us to what you are referring to.
+ 381376 [fs_tigre@ho ] Here.
| 381378 [steve@st ve ] Hey there! Maintainer of Shoes here!
+ 381385 [fs_tigre@ho ] Thank you for your reply!
| + 381429 [ashbbb@gm il] Umm,... No.
| + 381432 [steve@st ve ] Glad to hear it. :)
+ 381443 [fs_tigre@ho ] Thank you all for your help!
| 381450 [steve@st ve ] heheh, yes, that may be what I'm referring to. :/ Working on it!
+ 381486 [fs_tigre@ho ] Thank you for your help!
| 381491 [steve@st ve ] Only way to know for sure is to try. ;)
+ 381524 [fs_tigre@ho ] Thanks a lot for your help!
| 381529 [ashbbb@gm il] We are in the Shoes mailing list: http://librelist.com/browser/shoes/
+ 381538 [fs_tigre@ho ] Ok, Thanks a lot for your help.

[ANN] minitest 2.1.0 Released
381307 [ryand-ruby@z] minitest version 2.1.0 has been released!

Where can I find full documentation
381325 [fuksito@gm i] Good morning everyone,
+ 381339 [shortcutter@] Mahlzeit!
+ 381350 [u.alberton@g] You're simply looking at the wrong place - the "core" Ruby classes are

fill form when collection_select is changed
381332 [exedzy@gm il] Hey there. :)

puts box.dup.enlarge(4, 5)  -- unexpected result
381342 [mail@ss le s] I wonder why the statement "puts box.dup.enlarge(4, 5)" below gives
381344 [g.diemant@gm] A method returns the last evaluated expression. In your case thats @y2 += 5
381346 [mail@ss le s] Thanks!

Ruby for beginners (was: Re: Hello)
381355 [cmdjackryan@] page
+ 381363 [josh.cheek@g] When I was first learning to program I got into Ruby (on Windows at that
+ 381365 [sophrinix@gm] This is what TryRuby.org is suppose to be.
| + 381373 [cmdjackryan@] How are the lessons (well, the content, really, as opposed to the
| | 381388 [vmanis@te us] OK, so here's another kick at the can.=20
| | + 381396 [stu@ru yp og] For what it's worth I have been using interactive_editor gem in irb for a
| | | + 381410 [cmdjackryan@] CLI editors are great -- for advanced users.
| | | | 381458 [code@ap th o] ther
| | | | 381600 [stu@ru yp og] yup! glad my post caught someones eye =)
| | | + 381456 [code@ap th o] er
| | + 381409 [cmdjackryan@] I for one would approve of this.
| | + 381417 [jakekaiden@y] i definitely think this would be useful.  ruby is such a 'friendly'
| | + 381420 [josh.cheek@g] I think it would be good. New to programming tutorials should be very
| | | 381430 [vmanis@te us] already
| | | 381434 [cmdjackryan@] Good thing for open source and Creative Commons licensing.
| | | + 381487 [vmanis@te us] part.
| | | | 381495 [code@ap th o] That bothers me, too.  We should have an option that does not require
| | | | 381530 [cmdjackryan@] That would depend on how high valued platform independence is.
| | | | + 381535 [jdmaher@jd a] To me, it's about Ruby, NOT the editor.
| | | | | 381537 [cmdjackryan@] Same here. However, someone who beings Ruby, let alone programming, is
| | | | + 381536 [ajmxt9@ho ma] Posted via http://www.ruby-forum.com/.
| | | | + 381540 [code@ap th o] I've deleted any context to which I didn't feel a need to respond; it
| | | |   381543 [cmdjackryan@] misunderstand what you wanted to say.
| | | |   381557 [code@ap th o] More to the point, there are more users of Linux-based systems who are
| | | |   381560 [cmdjackryan@] Ah, I see. Well, in such a case a recipe to get up to speed with Ruby
| | | |   381569 [vmanis@te us] I've been out of the loop for the last day or so, so I've bundled up my =
| | | |   381572 [cmdjackryan@] nk most of us put together the environments we each like, and this should p=
| | | |   + 381576 [vmanis@te us] When I taught people introductory programming, I never covered any more =
| | | |   + 381579 [code@ap th o] That's not really a big problem.  The One True Editor is clearly vi.
| | | + 381508 [headius@he d] I think a DevKit tutorial was posted with JRuby instructions. They
| | + 381662 [terryo.ia@gm] by-lang.org, if there's sentiment that this would be a useful thing.
| + 381379 [jakekaiden@y] i think that TryRuby is a great start, though i agree that making the
+ 381441 [jdmaher@jd a] Ruby for beginners (was: Re: Hello)
  381445 [josh.cheek@g] Can Notepad do syntax highlighting? I think their editor / IDE should be
  381460 [code@ap th o] It used to be the case that the standard Ruby installer for MS Windows
  381490 [jakekaiden@y] another vote for SciTE!  it helped get me motivated to start
  381496 [code@ap th o] s/weary/wary/
threads.html
top