[#227496] What's the current standing of Rant vs. Rake? — "Chris Pearl" <chrispearl@...>
Rake seems to be used widely and extensively. Rails uses it pretty
[#227503] open-uril ECONNREFUSED problem — Cyrus Ghalambor <cyrusg@...>
I'm working on a simple scraping tool and the open() method has suddenly
WFM.
I've tried different URLs from different locations. Do you think setting
The following still has the same problem:
On Fri, 1 Dec 2006, Cyrus Ghalambor wrote:
Hi everyone,
On Dec 1, 2006, at 06:00 , Cyrus Ghalambor wrote:
[#227523] time = ["min", "sec"].collect {|i| {i=> Time.now.send(i).to_i}} — x1 <caldridge@...>
What's the best way to make the first item below yield a hash instead
[#227525] Ruby equivalent to "exec > $logfile 2>&1" in sh script? — Phil Rhoades <phil@...>
People,
[#227527] Gateway is malfunctioning — "Trans" <transfire@...>
Someone recently mentioned missing posts. I just did a comparsion of
On Nov 30, 2006, at 9:22 PM, Trans wrote:
Le 2 d馗embre 2006 11:16, F. Senault a 馗rit :
[#227535] how can someone see my webserver if I have a wireless router ? — wbsurfver@...
[#227536] Anomaly in first example of Needles, an Aspect-Oriented Programming tool — "Richard" <RichardDummyMailbox58407@...>
Hi All,
[#227556] How to create object of class name of which is in text string? — "xTRiM" <rtokarev@...>
I know what this is about Abstract Factory pattern. But in example at
[#227567] why does openstruct not respond to [] and []=? — "Martin DeMello" <martindemello@...>
Took me aback - there seems to be no reason for OpenStruct *not* to
On 01.12.2006 13:14, Martin DeMello wrote:
[#227574] Turtle Graphics (#104) — Ruby Quiz <james@...>
The three rules of Ruby Quiz:
On 12/1/06, Ruby Quiz <james@grayproductions.net> wrote:
On Dec 1, 2006, at 9:42 AM, Harold Hausman wrote:
On 12/2/06, James Edward Gray II <james@grayproductions.net> wrote:
"Harold Hausman" <hhausman@gmail.com> writes:
On Dec 1, 2006, at 3:44 PM, Daniel Martin wrote:
/usr/local/lib/ruby/site_ruby/1.8/tk.rb:1187: warning: instance variable
On Dec 1, 2006, at 7:22 PM, Edwin Fine wrote:
Morton Goldberg wrote:
From: Edwin Fine <efine145-nospam01@usa.net>
Hidetoshi NAGAI wrote:
From: Edwin Fine <efine145-nospam01@usa.net>
Here is my straight-to-the-point answer:
[#227583] ruby-services 0.2.0 — Daniel Berger <djberg96@...>
Hi all,
[#227630] Simple iteration in a function problem — Blake Miller <blakeage@...>
i'm trying to do this, and I'm stuck
Blake Miller wrote:
> Please show us your code, and make it as simple as possible. Like this:
[#227679] Komodo issue — Cyrus Ghalambor <cyrusg@...>
I'm trying to make an http conenction (to scrape a website) from within
[#227698] aws/s3 0.1.2 (point release) — "Marcel Molina Jr." <marcel@...>
A memory leak was discovered in the parsing code of aws/s3. The culprit was a
[#227702] calculations on lists of numbers — ara.t.howard@...
> cat list | mean
Le samedi 02 d馗embre 2006 05:02, ara.t.howard@noaa.gov a 馗rit
On Sat, 2 Dec 2006, Olivier wrote:
[#227739] openssl error - ubuntu — "Chad" <carimura@...>
Help!
Absolutely... I'm not a linux expert though, but I have a feeling
I finally figured it out.
On 12/3/06, Chad <carimura@gmail.com> wrote:
Thanks a lot pal, it worked perfectly for me too. I had the same openssl
So much for distribution's package managers making your life easier,
On 19/06/08 at 23:18 +0900, Marc Heiler wrote:
On Fri, Jun 20, 2008 at 1:18 PM, Lucas Nussbaum <lucas@lucas-nussbaum.net>
This worked for me:
Nate Wiger wrote:
[#227744] PDF::Writer and unicode — Simon Kröger <SimonKroeger@...>
Hi!
[#227769] search and replace — "ishamid" <ishamid@...>
[total novice here]
[#227781] more search and replace — "ishamid" <ishamid@...>
[Total novice]
[#227784] convert binary array to floating point decimal — "Nebiru" <Nebiru@...>
new to ruby here, looking for a little help
[#227788] gem requires not working — Steve Ross <cwdinfo@...>
I feel stupid about this, but I just did a fresh install of 1.8.5 from
[#227801] comma separating output from array.to_s — "jansenh" <henning.jansen@...>
hi comp.lang.ruby
Gregory Brown wrote:
On 12/2/06, William James <w_a_x_man@yahoo.com> wrote:
[#227813] LDAP library in Ruby — Michael Perle <michael_perle@...>
Hi,
[#227819] Factory pattern, abstract base class — "Daniel Berger" <djberg96@...>
Hi all,
On Dec 2, 2006, at 5:15 PM, Daniel Berger wrote:
On 12/3/06, James Edward Gray II <james@grayproductions.net> wrote:
Daniel Berger wrote:
On Dec 2, 2006, at 7:27 PM, Joel VanderWerf wrote:
James Edward Gray II wrote:
[#227835] Development hpricot breaks code — "lrlebron@..." <lrlebron@...>
I was using this simple script to parse some links from a web page
[#227839] Why does a test fail when I predicted it's exception class? — "Richard" <RichardDummyMailbox58407@...>
Hi,
Hi Robert & Louis,
On Dec 2, 2006, at 20:40 , Richard wrote:
Hi Eric,
[#227857] File.size() returning negative for large files ???? — "Greg Hauptmann" <greg.hauptmann.ruby@...>
Hi,
Greg Hauptmann wrote:
Is there a work around for this guys?
On Dec 3, 2006, at 24:30 , Greg Hauptmann wrote:
On 12/3/06, Eric Hodel <drbrain@segment7.net> wrote:
Pedro Fortuny Ayuso wrote:
[#227860] I'm a new member — "Quỳnh Trần" <quynh_khanh2002@...>
Hi evrybody!
Que1bbb3nh Tre1baa7n wrote:
Hi all,
On 12/3/06, chen li <chen_li3@yahoo.com> wrote:
Hi --
Hi all,
[#227873] Simple and stuppid bug (can anyone find it?) — "paul" <pjvleeuwen@...>
Hi all,
On 12/3/06, paul <pjvleeuwen@gmail.com> wrote:
[#227878] Gtk::ProgressBar set_fraction doesn't work — Patrick Plattes <patrick@...>
Hello,
[#227894] Weird thing with sockets — Arie Hofland <arie_hofland@...>
First off - i'm a n00b at ruby. This doesn't mean i'm a noob at
[#227913] mailing list question? — Li Chen <chen_li3@...>
Hi all,
On 03.12.2006 16:50, Li Chen wrote:
[#227930] Intermittant problem with Hpricot — Allison Newman <demallien@...>
I've run into a wierd problem with the Hpricot gem. I don't know if
You can change the code one of two ways to get it to work
[#227933] Can one use line addresses...to select a portion of file — "Jacob, Raymond A Jr" <raymond.jacob@...>
I would like to select a portion of a file to process like I did with
On Mon, Dec 04, 2006 at 03:19:25AM +0900, Jacob, Raymond A Jr wrote:
[#227945] How to get operating system type info — Dao Shi <zhoubo61@...>
Hi Guys,
[#227970] number format — Li Chen <chen_li3@...>
Hi all,
[#227979] method overloading like Java? — Daniel Finnie <danfinnie@...>
In Java, you could write the following code:
> Is there a way to do this in Ruby? I am aware of method(*args) and
On 12/3/06, Gordon Thiesfeld <gthiesfeld@gmail.com> wrote:
[#227980] FastRI, handling identical class names and methods — Daniel Berger <djberg96@...>
Hi,
[#227998] Why this script doesn't work? — Li Chen <chen_li3@...>
[#228025] How to populate a 2D array data into Excel using WIN32OLE — Li Chen <chen_li3@...>
Hi all,
[#228028] Getting the source code of a block — Peter Szinek <peter@...>
Hello,
On 04.12.2006 12:20, Peter Szinek wrote:
[#228030] problem with ActiveRecord and PDFWriter — hemant <gethemant@...>
Probably this has been discussed earlier elsewhere.
On 12/4/06, hemant <gethemant@gmail.com> wrote:
[#228031] Question about Ruby philosophy — Zouplaz <user@...>
Hello, when I compare Ruby to Java there is something I don't understand .
On 04.12.2006 13:04, Zouplaz wrote:
On 12/5/06, Robert Klemme <shortcutter@googlemail.com> wrote:
On 12/4/06, Zouplaz <user@domain.invalid> wrote:
The bottom line seems to be that the current crop of Ruby programmers
On Tue, 5 Dec 2006, Edwin Fine wrote:
It's a serious question concerning language philosophy and design.
Hi,
On 2006-12-05, Edwin Fine <efine145-nospam01@usa.net> wrote:
Jeremy Henty wrote:
On Thu, 7 Dec 2006, Edwin Fine wrote:
On 12/7/06, John Carter <john.carter@tait.co.nz> wrote:
[#228047] replace delimiter in unicode encdoded file — "ciapecki" <ciapecki@...>
Is there a way in ruby to:
[#228055] MySQL and SQLite question — "nephish" <nephish@...>
Lo there all.
[#228075] help, my 'case/when' code doesn't work — cremes.devlist@...
I've been using ruby for several months now so imagine my surprise when I wrote something using the 'case' construct and I discovered that I didn't understand how to use it! What's worse is that even after looking through the Pickaxe and some code "in the wild" that uses 'case' I still don't see what I'm doing wrong.
[#228085] Tool for Program Visualization ? — Gilbert Rebhan <mailforgilbert@...>
Hi,
[#228108] Swig, Ruby, C++ question — "Daniel Berger" <djberg96@...>
Hi all,
[#228127] How do I catch a missing method on a passed block? — "J2M" <james2mccarthy@...>
I would like to invoke method_missing on baz in this code;
On Tue, 5 Dec 2006, J2M wrote:
On Tue, 2006-12-05 at 08:04 +0900, J2M wrote:
On Tue, Dec 05, 2006 at 11:54:06PM +0900, Daniel Schierbeck wrote:
Logan Capaldo wrote:
On 12/6/06, Tim Fletcher <twoggle@gmail.com> wrote:
Ah, see what you mean now :)
This is what I finally ended up with - which I think is quite elegant
Hi --
Hi --
[#228160] doubt with positive lookaround — hemant <gethemant@...>
I do not understand behavior of positive look arounds in Ruby:
[#228172] looping through & downloading web page - WATIR codes — "curious" <csamigroup@...>
What I am trying to realize through code below is to read a line by
[#228176] Integer#to_s(2) works on x86, fails on x86_64 — Suraj Kurapati <snk@...>
Hello,
[#228193] Starting XMLRPC server on virtual host returns EADDRNOTAVAIL — Rene Tschirley <ruby@...>
Dear ruby experts,
[#228196] TDD/unit testing question — Peter Szinek <peter@...>
Hello,
Hi,
[#228198] String#crypt first 8 characters — Patrick Plattes <patrick@...>
Hello,
[#228201] A true Ruby compiler (for Linux) — Philip Rhoades <phil@...>
People,
[#228215] Using Relax NG as a grammar — "Daniel Berger" <djberg96@...>
Random thought of the day...
[#228216] Unexpected scope range — Andreas Warberg <andreas.warberg@...>
I am new to Ruby but have a strong java background.
[#228266] md5 function in Ruby — Denys Yakhnenko <dyakhnenko@...>
Hello all:
Denys Yakhnenko wrote:
[#228273] Lisp comprehensions => SQL — "Victor \"Zverok\" Shepelev" <vshepelev@...>
Hi all.
On Wed, Dec 06, 2006 at 06:58:49AM +0900, Victor Zverok Shepelev wrote:
From: Logan Capaldo [mailto:logancapaldo@gmail.com]
On Wed, 6 Dec 2006, Victor "Zverok" Shepelev wrote:
From: khaines@enigo.com [mailto:khaines@enigo.com]
On Wed, 6 Dec 2006, Victor "Zverok" Shepelev wrote:
From: khaines@enigo.com [mailto:khaines@enigo.com]
On Wed, 6 Dec 2006, Victor "Zverok" Shepelev wrote:
[#228275] ie.link(:text, "Next").click — "curious" <csamigroup@...>
I am navigating through web page using WATIR..
[#228306] Using Mkmf to Verify Libraries — Steven Hansen <runner@...>
[#228330] Apache and Ruby — "Phillip Neiswanger" <sigsegv@...>
Hi,
[#228352] Newbie: working with a text file and converting to xml — Adam Teale <ateale@...>
hi Guys,
Adam Teale wrote:
Hi Kev & Peter!
Adam Teale wrote:
Hi Peter,
[#228364] GOLF: hex string to dotted quad — "Martin DeMello" <martindemello@...>
irb(main):021:0> hex_ip = "c0a80167"
On 12/6/06, Martin DeMello <martindemello@gmail.com> wrote:
[#228379] Calling super in overwritten methods — Joerg Diekmann <joergd@...>
Hi - not sure if this is possible - but it feels like it could be with
[#228380] join_with — "Martin DeMello" <martindemello@...>
While golfing with the hex_ip thread, I realised that map takes no
On 06.12.2006 11:40, Martin DeMello wrote:
Hi --
On 12/13/06, dblack@wobblini.net <dblack@wobblini.net> wrote:
"Martin DeMello" <martindemello@gmail.com> writes:
[#228414] Default values for method arguments — "paul" <pjvleeuwen@...>
Hi all,
[#228422] invasive parameters as method mode variables — "Trans" <transfire@...>
Working on a method where I would like one part of it's operations to
On Thu, 7 Dec 2006, Trans wrote:
On 06.12.2006 18:37, Trans wrote:
On 12/6/06, Trans <transfire@gmail.com> wrote:
[#228437] Difference between nil? vs. (variable != nil)... — "Jason Vogel" <jasonvogel@...>
Source A :
[#228463] Installing shared object library into non-standard directory — "Joe Van Dyk" <joevandyk@...>
Hi,
[#228464] Get Number of regex matches — Ingo Weiss <ingoweiss@...>
Hi,
[#228471] general question about ri and specific question about LookupAccountName — "Jason Mayer" <slamboy@...>
While looking through ri File, I found Windows::Security, and in there is a
[#228475] Ruby based SMTP server? — "Peter Smith [gjfc]" <goodjobfastcar@...>
People,
[#228490] Why is this regex invalid? — Daniel Finnie <danfinnie@...>
irb(main):002:0> regex = /([0-9]*)([^\+- ]+)(.*)/
[#228508] Problem with Marshaling WeakRefs? — umptious@...
I'm experimenting with Marshal, but I'm having problems making it work
[#228509] Using Ruby Web Service from a C# .NET Client — "ParappaYo" <parappayo@...>
I'm trying to set up a sample project of a Ruby web service consumed by
[#228533] : partitioning an array — "Max Muermann" <ruby@...>
Take an array of objects and partition it into subarrays, based on
On Thu, 07 Dec 2006 03:46:37 -0000, Max Muermann <ruby@muermann.org> wrote:
[#228555] puts overwrite line — "Raymond O'connor" <nappin713@...>
Hi,
[#228571] How to unpack unusual binary structure? — Leo -- <leopardus.vulgaris@...>
Hello everyone
[#228574] NoMethodError in protocol.rb — Alex Young <alex@...>
Does this look familiar to anyone?
[#228580] REXML/RSS parse error — Patrick Plattes <patrick@...>
Hello,
[#228583] insert into erb binding — Jeremy Wells <jwells@...>
I have a class that takes a template, parses it through ERB, then takes
[#228586] rescue and continue on next statement ? — Zouplaz <user@...>
Hello, I've seen there is a retry statement that rerun the entire
[#228596] IEEE-488 (GP-IB) Interface Lib for Ruby — "John Joyce" <John.Joyce@...>
Greetings,
[#228603] Odd result when attempting to use Mechanize in parallel with Threads — "Richard Conroy" <richard.conroy@...>
I wrote a simple tool to iterate a network to try and find web servers
[#228605] Show your support for Rubinius! — "Sam Smoot" <ssmoot@...>
(I hope you don't mind a bit of cross-posting, but seeing as how the
On 12/7/06, Sam Smoot <ssmoot@gmail.com> wrote:
On 12/7/06, Tim Pease <tim.pease@gmail.com> wrote:
On 12/7/06, Brian Mitchell <binary42@gmail.com> wrote:
I'd like to know more about Rubinius, but all the info I've got on it
On 12/7/06, benjohn@fysh.org <benjohn@fysh.org> wrote:
AFAIK, Ruby does not have a formal language specification. The language
They are working on an official Ruby spec and testing suite.
Hi --
On Dec 10, 2006, at 9:12 AM, dblack@wobblini.net wrote:
[#228628] Array changing after concat function — WKC CCC <wai-kee.chung@...>
Can someone shed some light on this problem. In the example, I am
WKC CCC <wai-kee.chung@uk.bnpparibas.com> wrote:
unknown wrote:
[#228660] Re: openstruct oddity — "Andreas S" <andreas_s@...>
>This one does not:
[#228665] Colored error messages — Yu Co <djhackebeil@...>
Hi,
On Dec 7, 2006, at 14:48 , Yu Co wrote:
Eric Hodel wrote:
[#228668] Ruby enums in C — "Joe Van Dyk" <joevandyk@...>
Each instance of Joe has a MOOD which can be HAPPY, SAD, or NEUTRAL.
[#228669] Help with rake — Jeremy Woertink <its_conebred_foo@...>
Can anyone tell me exactly how rake works? How does it know what to do?
[#228682] exit — "ao tianlong" <aotianlong@...>
how can i exit
[#228684] Need help with a regexp — "rpheath" <rpheath@...>
I'm trying to write a regular expression to replace a <pre>...</pre>
[#228702] Execute environment - rake aborted! - no such file to load -- openssl — "dave ." <vancouverhg@...>
On 12/8/06, dave . <vancouverhg@hotmail.com> wrote:
Env: Ruby 1.8.5, Linux RedHat 7.3
dave . wrote:
[#228716] Am I missing something about BER-compressed integer? — "Francis Cianfrocca" <garbagecat10@...>
All:
Need an advice please,
On 12/8/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
Francis Cianfrocca wrote:
[#228723] pam_ruby and "require" statement — Vladimir Konrad <v.konrad@...>
[#228725] Exiting a DialogBox created with FoxGUIb — e aldaz <ardhazes@...>
Dear All
[#228738] Tournament Matchups (#105) — Ruby Quiz <james@...>
The three rules of Ruby Quiz:
I have some questions about this problem.
On 12/10/06, Daniel Finnie <danfinnie@optonline.net> wrote:
Here's my solution. It assumes that the teams are ranked by skill. I
[#228740] Using Ruby to change printer preferences in Win32 — "Anders" <anders.schneiderman@...>
Our Windows XP sys admins recently changed things so that every day,
[#228759] Re: Fwd: Seymour Papert Gravely Injured in Motorbike Accident — "Trans" <transfire@...>
[#228766] Module issue — "Jason Vogel" <jasonvogel@...>
Disclaimer: Ruby Nuby
[#228770] autotest, unit-diff, and color output? — "Rob Sanheim" <rsanheim@...>
I'm using autotest with all its test driven goodness, and I believe
On Dec 8, 2006, at 09:26 , Rob Sanheim wrote:
On 12/8/06, Eric Hodel <drbrain@segment7.net> wrote:
On 12/11/06, Rob Sanheim <rsanheim@gmail.com> wrote:
[#228782] Marshal::dump error on PowerBook G4 — "Emmett Shear" <emmett.shear@...>
I've written code for a Splay tree in Ruby, and I'm trying to
[#228783] Capitalization — "Jason Vogel" <jasonvogel@...>
Disclaimer : Ruby Nuby and I don't know RegEx basically at all. I know
Jason Vogel wrote:
[#228791] Sourcing bash aliases with Ruby — Chris Kilmer <christopher.kilmer@...>
I'm trying to build a script that automates the sourcing of multiple
[#228797] replacing maven with rake + rjb + ant — "thebox" <piergiuliano.bossi.news@...>
Hi!
On 12/8/06, thebox <piergiuliano.bossi.news@gmail.com> wrote:
Tanner Burson wrote:
On Dec 8, 4:32 pm, David Vallner <d...@vallner.net> wrote:
[#228798] Beginners question about Array#assoc — Chad Thatcher <chad@...>
Hi, I am new to Ruby and still finding it very strange even though I am
[#228818] beginner Q: Kernel#puts, STDOUT, $stdout relation — "Andreas S" <andreas_s@...>
Can anybody help me understanding the relation between Kernel#puts, STDOUT
[#228833] autotest broken on winxp? — "Jeff" <cohen.jeff@...>
I haven't tried autotest on windows for a long time, but I thought it
[#228842] YAML extension not honouring the options passed to .to_yaml — Chad Thatcher <chad@...>
[#228862] Need help on a program — Christopher Latif <christopherl@...>
Stuck on this exercise from a book:
Christopher Latif wrote:
[#228869] Dynamically Create Singleton Method — "pachl" <clintpachl@...>
I'm not sure how to explain what I'm looking for so I will show you:
[#228875] Ruby Core + Php FrontEnd (open) — Flaab Mrlinux <flaab_mrlinux@...>
Good afternoon everyone.
Hi Flaab,
[#228885] TeX and ruby — pierodancona@...
Hi,
[#228891] File.yaml?(fname) — "Trans" <transfire@...>
what's the best way to determine if a file is yaml?
[#228914] bending ruby space — "Trans" <transfire@...>
i came upon this "pattern" working on a rather difficult problem. see
On Sun, 10 Dec 2006, Trans wrote:
[#228918] Help me with some nested Hashes. — Daniel Finnie <danfinnie@...>
What I want to do is have 2 nested hashes, the outer hash returning a
[#228945] format problem — chen li <chen_li3@...>
Hi all,
chen li wrote:
Li Chen wrote:
[#228958] asynchronous select from queue — Boris Mojo-jojo <boris.ouretskey@...>
Please advise on how to implement multiple select from queues in Ruby. I
On Dec 10, 2006, at 24:50 , Boris Mojo-jojo wrote:
Eric Hodel wrote:
[#228962] rubyscript2exe problem (yes another) — "Anselm (anonymous)" <anselmthecrack@...>
hello!
[#228963] qtruby problems — "Martin DeMello" <martindemello@...>
I have both qtruby and qt4-qtruby installed (via the gentoo ebuilds),
[#229011] Ruby training? — "Michael T. Halligan" <michael@...>
I'd like to send a couple of my employees to a Ruby class, the ideal
[#229014] defining key equivalence in a hash — Suraj Kurapati <snk@...>
Hello,
[#229024] Question on IO objects, initialize, and yaml — "Mark Noworolski" <jmarkn@...>
Say I have a class with pseudo code as follows:
On Dec 10, 2006, at 12:19 , Mark Noworolski wrote:
[#229025] Scope of block — "daniel" <daniel@...>
Hello i have a question about scopes of block
[#229035] Monkey Patching a method and back — "S. Robert James" <srobertjames@...>
I need to temporarily mokey patch out a method in a certain class used
On Dec 10, 2006, at 3:35 PM, S. Robert James wrote:
Will this be OK even if patched and unpatched multiple times?
[#229062] Newbie question about pop3 access — "furby" <WookieTim@...>
I am rather new to Ruby and I want to write a program to play around
[#229094] TkCanvas on windows seems slow — Joel VanderWerf <vjoel@...>
[#229095] Regexp/scan question — Peter Szinek <peter@...>
Hello,
[#229119] else inside rescue is useless? — "cap" <capitain@...>
http://www.awprofessional.com/bookstore/product.asp?isbn=0672328844&rl=1
On 11.12.2006 13:17, cap wrote:
On 12.12.2006 00:15, Dave Thomas wrote:
[#229122] Newbie questions — Dav Jones <kakaze@...21.com>
Hello, I'm quite new to this whole Ruby malarky and I'm having some real
OK that makes a lot less sense...I don't recognise many of those
[#229139] Questions about DRb and security — "Jonas Pfenniger" <zimbatm@...>
Hello,
[#229144] Help recherche de package — "Dom" <vialadom@...>
Bonjour
[#229178] Win32 environment for ruby extension work — "Ross Bamford" <rosco@...>
Hi,
[#229183] Is there something like Regexp#match_all — Andi Schacke <memberships.andi@...>
Hi,
[#229194] gtkhtml2 blank window — Patrick Plattes <patrick@...>
hi ho ml :-),
[#229195] Re: best way to dynamically create new instance methods — "Gavin Kistner" <gavin.kistner@...>
From: James Edward Gray II [mailto:james@grayproductions.net]
[#229210] private methods in Ruby — hemant <gethemant@...>
##Won't work method #1
[#229218] Inserting surrounding scope into singelton method definition — Sebastia <shfriedrich@...>
I have a sorted array (in this case, an ActiveRecord result set) that i
[#229230] Ruby, Windows XP, and CMD.exe — Clark Snowdall <clark.snowdall@...>
Hello all,
[#229238] Rassmalog 1.0.0 — Suraj Kurapati <snk@...>
Version 1.0.0 (2006-12-11)
[#229240] UID/EUID subshell solutions — Luke Kanies <luke@...>
Hi,
[#229244] Re: Ruby for Kids? — "Jeff_M" <JeffMcGrath@...>
Jeff_M wrote:
what would be good is something like KPL
[#229251] Runtime Error Installing Ruby 1.8.5 — muraii@...
Hi there,
[#229257] Non-useless mode for YAML::Syck::Map.children_with_index? — "Phlip" <phlipcpp@...>
Rubistas:
Phlip wrote:
[#229276] Predefined variable to represent the ruby installation path? — Olivia Dou <dou_yifan@...>
Is there a Predefined variable that represent the ruby installation
[#229277] connect to MySQL Database — Jochen Kaechelin <fvgi242ss@...>
Hello list,
Hi,
Kashia Buch schrieb:
[#229280] Using the SaveAs in Excel not working with Ruby — anon1m0us@...
Hi;
[#229297] Directory Size and bolding Excel cells — anon1m0us@...
Does anyone know any commands that will tell me the size of a
anon1m0us@yahoo.com wrote:
I tried
Nope:
[#229304] Re: Ruby for Kids? — Bil Kleb <Bil.Kleb@...>
Kerry Stevenson wrote:
[#229330] Assignment method strangeness — "Ryan Williams" <mr.cruft@...>
Assignment methods are weird, and I wish they acted more like regular
[#229350] C => Ruby plus TCP serialization using Marshal.dump/load — "Nathan Baker" <nathanb@...>
Hey,
On Wed, 13 Dec 2006, Nathan Baker wrote:
On 12/12/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Wed, 13 Dec 2006, Tim Pease wrote:
[#229351] - Bible 1.0.1 - A bible reference parsing and text retrieval tool — "Justin Bailey" <jgbailey@...>
All,
Wow this looks great! Thanks for building this.
On Wed, 2006-12-13 at 07:36 +0900, Justin Bailey wrote:
Hi!
On 12/23/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
[#229380] Storage binding — Can Ceran <ccermikli@...>
Hi,
[#229383] how to add a method_missing method into ActiveRecord — "ao tianlong" <aotianlong.com@...>
i want to write a plugin
[#229395] How to overload the operator !=? — ankyhe@...
I overload ==, >, <, >=, <=successfully, however I can't overload != .
On 12/13/06, ankyhe@gmail.com <ankyhe@gmail.com> wrote:
[#229397] Restricted capture in Regexp — benjohn@...
Is there a regexp feature that lets me require something to be present
benjohn@fysh.org wrote:
[#229398] How to improve my Ruby skills ? — Zouplaz <user@...>
Hello there... Like many others I've discovered Ruby when I started
On 12/13/06, Zouplaz <user@domain.invalid> wrote:
What about a Nuby Quiz?
On 12/13/06, Jason Mayer <slamboy@gmail.com> wrote:
On Dec 13, 2006, at 7:00 AM, Jan Svitok wrote:
[#229403] hpricot selective text modification — "Siddharth Karandikar" <siddharth.karandikar@...>
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/207625
[#229430] Hpricot html parsing — Dhanasekaran Vivekanandhan <mail2sek@...>
hi all,
Dhanasekaran Vivekanandhan wrote:
yes, I want the text of the first <p> because it
Dhanasekaran Vivekanandhan wrote:
[#229431] Saikuro v0.2 Released — "Zev Blut" <rubyzbibd@...>
Saikuro is a Ruby cyclomatic complexity analyzer.
[#229443] How do I run WEBrick as a daemon? — Ashley Moran <work@...>
Hi
On 12/13/06, Ashley Moran <work@ashleymoran.me.uk> wrote:
[#229467] Net::Ldap question — Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@...>
Hello, I'm trying this plugin in a rails app and think I need some help.
Hehe, sorry again. I've reading documentation of this library and already know
On 12/13/06, Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@nospamgmail.com> wrote:
> Are you using the latest version of Net::LDAP?
On 12/14/06, Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@nospamgmail.com> wrote:
The LDAP server is from Netscape, don't know exactly which version is it.
On 12/14/06 10:18 AM, "Eduardo Y瘻ez Parareda"
Thanks a lot to Francis and David, finally I got it. Since I don't have an administration account,
On 12/19/06, Eduardo Y瘻ez Parareda <eduardo.yanezNOSPAM@nospamgmail.com> wrote:
[#229473] #N/A bug segmentation — WKC CCC <wai-kee.chung@...>
I am using ruby with COM objects. On certain COM function calls the
[#229477] How to always write Windows style newlines to a file? — Wes Gamble <weyus@...>
I need to write a CSV file and I know that I always want Windows style
On 13.12.2006 19:04, Daniel Berger wrote:
[#229481] SVG Canvas — "Steven Quinones-Colon" <stevenq1967@...>
I've been looking for a couple of days now and I can't find a library
[#229511] Random idea - private, blocks, constants — "Daniel Berger" <djberg96@...>
Hi all,
[#229527] FasterCSV - Writing to File Question — Drew Olson <olsonas@...>
Based on a previous thread, I gave FasterCSV a try and I've been very
[#229539] Re: gems cleverness? — Eric Hodel <drbrain@...7.net>
On Dec 11, 2006, at 19:31, Giles Bowkett wrote:
[#229542] image_science 1.0.0 Released — Ryan Davis <ryand-ruby@...>
image_science version 1.0.0 has been released!
Hi Ryan,
[#229550] DateTime.strptime() — "Matt G." <mattismyname@...>
Sorry for posting a beginner question here, but it seems like date/format.rb
[#229552] array and hash combine methods — glen <glen83@...>
Just thought I'd post a solution I came up with to finding
[#229575] FXRuby 1.6.4 redux — "Michael T. Richter" <ttmrichter@...>
OK, thanks to the timely help of Lyle Johnson (Thanks, Lyle!) I got
[#229579] What is the meaning of Dim — chen li <chen_li3@...>
Hi all,
[#229598] CTI Corporativo auto responses — "Daniel Berger" <djberg96@...>
All,
[Giles Bowkett <gilesb@gmail.com>, 2006-12-15 20.49 CET]
[#229600] Swap contents in two files — Christopher Latif <christopherl@...>
I have two files, I want to swap the contents of the files in my
2006/12/14, Christopher Latif <christopherl@bredband.net>:
Robert Klemme wrote:
On 12/14/06, Christopher Latif <christopherl@bredband.net> wrote:
On Thu, 14 Dec 2006, Christopher Latif wrote:
Hi --
[#229622] — "Maksim Bartenev" <bartenev@...>
Hi!
[#229647] FYI - Ruby related article/blog on Reddit front page — Drew Olson <olsonas@...>
It's not the most flattering blog post:
To be honest, I found the blog post pretty much right on. Ruby is a great
Hi --
[#229652] Hash/2-d array help! — Just Maz <josquius@...>
Would anyone happen to know how would I go about creating a hash where I
[#229663] Ruby File Copy SEG-FAULT on 64-bit System — Cynthia Jeness <cjeness@...>
I have a Ruby script which copies certain files from one subdirectory to
[#229675] ruby/ole excel delete row? — "eching" <bingopajama@...>
How do I delete a row in an excel spreadsheet with win32ole?
You could use:
[#229683] String#insert method is destructive... inconsistent? — Joe Peterson <joe@...>
Hi all,
I also started wondering...
[#229691] Variables and References — "Aytek Ysel" <aytekyuksel@...>
Hi,
[#229708] Why is define_method private? Plus, what's the point of private methods? — Daniel Finnie <danfinnie@...>
Why is define_method a private method? I can't recall ever using
[#229714] IO output problem — "Kevin" <coscpp@...>
I run one of examples of Programming Ruby, code as follows:
[#229727] win 32 utils changenotify — "lrlebron@..." <lrlebron@...>
I just downloaded and installed the win32utils installer. When I try to
I downloaded the file and renamed it according to your instructions but
lrlebron@gmail.com wrote:
Thanks,
[#229745] Dhaka 0.0.5 bugfix — "Mushfeq Khan" <mushfeq.khan@...>
This version of the Dhaka gem fixes two bugs in the handling of grammars
On Dec 15, 2006, at 12:38 AM, Mushfeq Khan wrote:
On 12/15/06, James Edward Gray II <james@grayproductions.net> wrote:
Yes, that is indeed correct. Thanks for the encouraging comments.
[#229753] method_missing question — Peter Szinek <peter@...>
Hello,
[#229760] What tracking software does Rubyforge use? — "Pat Maddox" <pergesu@...>
Does anyone know what software Ruby uses for the bug/requests/patches
On 12/15/06, Pat Maddox <pergesu@gmail.com> wrote:
[#229763] Chess960 (#106) — Ruby Quiz <james@...>
The three rules of Ruby Quiz:
Is that the real starting position 432? Or was that just a made up number?
On Dec 15, 2006, at 9:25 PM, Daniel Finnie wrote:
D:\Docs\ruby>ruby chess960.rb
Here is my solution. Run with no argument, it generates a random
[#229771] using Proc and yield — Alber Eric <alberthier@...>
hi !
Hi,
[#229782] REXML usage — Kevin Tambascio <kevin.tambascio@...>
I'm developing a project that allows my client to import an XML file.
[#229794] Thread and sleep — "Tim Pease" <tim.pease@...>
$ cat a.rb
On Sat, 16 Dec 2006, Tim Pease wrote:
On 12/15/06, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Sat, 16 Dec 2006, Tim Pease wrote:
[#229800] EXCEL Ruby not working — "anon1m0us" <anon1m0us@...>
I get a file name in the directory and modify the cells with making
[#229815] newb: Rails character encoding and validation — Mark <user@...>
I'm putting together a basic rails application, and writing my first
It is not really viable to validade a name field with a regex if youare willing to accept Unicode characters. The only reasonablevalidation is to check whether the field is empty.
[#229836] Popup Window Problem AJAX — Mark Dodwell <seo@...>
When I try to use Ajax in a window openened by 'window.open('<url>');'
[#229851] matching lines.... — Just Maz <josquius@...>
I'm really wracking my brain about this one though I bet there must be
[#229860] Dynamic Variable Names — "Chris Martin" <chriscodes@...>
Is it possible to create dynamic variable names in ruby?
[#229869] where is YAML::Syck's maling list? — "Phlip" <phlipcpp@...>
Ruboids:
[#229883] ZenTest autotest problems — Zouplaz <user@...>
Hello, I have big troubles using the latest autotest version (3.4.2)
On Dec 16, 2006, at 01:40, Zouplaz wrote:
le 17/12/2006 07:43, Eric Hodel nous a dit:
On Dec 17, 2006, at 24:55, Zouplaz wrote:
le 18/12/2006 06:50, Eric Hodel nous a dit:
[#229887] how to install ERb? — Malamute Jute <mutedev@...>
hi everyone. im reading and following the ruby for rails book and im on
On 12/16/06, Malamute Jute <mutedev@yahoo.co.uk> wrote:
[#229906] Just some Ruby language ideas, comments wanted. — Daniel Finnie <danfinnie@...>
My first Ruby language idea is simple. Instead of having every method
Daniel Finnie wrote:
Devin Mullins wrote:
[#229917] does Ruby generate WINDOWS and dialog boxes? — "Ken Laninga" <personal@...>
I just heard about Ruby and it looks fascinating. I see lots of code being
Ken Laninga wrote:
David Vallner wrote:
Joel VanderWerf wrote:
Suraj Kurapati wrote:
On Sun, 2006-17-12 at 10:09 +0900, Suraj Kurapati wrote:
Michael T. Richter wrote:
Richard wrote:
Richard wrote:
> Odds are it Just Won't unless you only
Richard wrote:
Disclaimer: All my assertions about Ruby, Rails, WEBrick and MySQL are
Richard wrote:
Hi Suraj,
Richard wrote:
On Dec 17, 11:17 pm, "Richard"
John Wilger wrote:
[#229930] Using ruby in applescript studio — bluephonic@...
Hi -- I'm not a programmer by trade or inclination, so this might be a
bluephonic@gmail.com <bluephonic@gmail.com> wrote:
I thought about that, but (if I'm not mistaken) it would mean anyone
[#229935] RPA wiki down/gone? — "Jeremy McAnally" <jeremymcanally@...>
I just tried to get onto the Ruby Production Archive wiki, and it
[#229946] question about .gsub — Jochen Kaechelin <fvgi242ss@...>
line = `tree /Users/aragon/Documents -d`
[#229993] hpricot problem — Henry Maddocks <henryj@...>
Not sure where to send this, sorry if it's not the right place...
[#229994] hpricot problem — Henry Maddocks <henryj@...>
Sorry, try again...
[#230003] Why the resutls are different — Li Chen <chen_li3@...>
Hi all,
[#230008] Grabbing data off a webpage — Bil Kleb <Bil.Kleb@...>
OK, so I haven't done this in years.
Hi Bill,
On 12/17/06, Peter Szinek <peter@rubyrailways.com> wrote:
[#230011] Ruby IDE — <adaworks@...>
I am new to Ruby, but I have used a lot of other
[#230017] why private is not private — Li Chen <chen_li3@...>
Hi all,
Li Chen wrote:
[#230025] Looping: break every x times — sshikari@...
I have a bunch of pictures to display on a page and I want to do 4 per
[#230055] DateTime — Lucas Holland <hollandlucas@...>
Hi,
[#230084] FXIrb 0.3.0 - the "it lives!" release — "Martin DeMello" <martindemello@...>
Thanks to Markus Prinz for filing a bug report and getting me to take
[#230089] Question regarding threads and I/O — "Michael W. Ryder" <_mwryder@...>
I am a veteran programmer but still am trying to learn Ruby. In the
On Mon, Dec 18, 2006 at 08:55:10AM +0900, Michael W. Ryder wrote:
Logan Capaldo wrote:
On Mon, Dec 18, 2006 at 10:40:05AM +0900, Michael W. Ryder wrote:
Logan Capaldo wrote:
On 18.12.2006 03:59, Michael W. Ryder wrote:
[#230105] Finding an object in a collection — Pieter Mans <tybriel@...>
How would I go about finding an object in a collection? Specifically:
[#230139] Ruby Cookbook, opinions? — "Richard Conroy" <richard.conroy@...>
Taking a break from Holiday shopping I found that my local bookstore
[#230147] Problem installing Ruby/Tk — Christopher Latif <christopherl@...>
Installed Linux
> Installed Linux
> Can you check whether you have Tk installed in your system, and in
> How can I determine if I have Tk installed?
[#230152] JRake — Bil Kleb <Bil.Kleb@...>
Fowler points to some folks replacing Ant with Rake:
[#230162] item order in Object#methods — Andrea Fazzi <andrea.fazzi@...>
Hi all,
[#230166] parseexcel — Li Chen <chen_li3@...>
Hi all,
[#230196] Ruby, Debian, and Media Temple — "Trevor Turk" <trevorturk@...>
I recently tried to run some Rails plugins (techno-weenie's White
[#230206] Rassmalog 2.1.1 — Suraj Kurapati <snk@...>
Rassmalog is a static blog engine based on RSS 2.0, YAML,
[#230225] Simple copy of attributes — Vincent Fourmond <vincent.fourmond@9online.fr>
[#230251] Using gems on Windows without dependencies — "S. Robert James" <srobertjames@...>
gem install GEMNAME -f seems to fail on Windows. That is, if you say
[#230256] where have all the experienced users gone? — "Trans" <transfire@...>
seems like there's been a steady drop off in experienced ruby users on
On Dec 18, 2006, at 18:50, Trans wrote:
Eric Hodel wrote:
On 12/19/06, Jeremy Wells <jwells@servalsystems.co.uk> wrote:
I think it's also important that we all realize that we use mailing
On Dec 19, 2006, at 7:52 AM, Jeremy McAnally wrote:
James Edward Gray II wrote:
Eric Hodel wrote:
On Wed, 2006-20-12 at 02:31 +0900, James Britt wrote:
On 12/19/06, Trans <transfire@gmail.com> wrote:
On 12/19/06, Robert Dober <robert.dober@gmail.com> wrote:
On 12/20/06, Simon Strandgaard <neoneye@gmail.com> wrote:
On 12/20/06, Trans <transfire@gmail.com> wrote:
On 23.12.2006 15:16, Trans wrote:
On further reflection, perhaps something at the gateway/server level
James Edward Gray II wrote:
On Dec 19, 2006, at 2:00 PM, Paul Lutus wrote:
On 12/20/06, James Edward Gray II <james@grayproductions.net> wrote:
On 2006-12-19, Eric Hodel <drbrain@segment7.net> wrote:
[#230263] find all possible container nodes of a given text — Sylvain Tenier <sylvain.tenier@...>
hi,
[#230271] Re: where have all the experienced users gone? — "Gavin Kistner" <gavin.kistner@...>
From: Trans [mailto:transfire@gmail.com]
On 19.12.2006 07:29, Trans wrote:
[#230279] Strategies for writing Ruby applications to be easily distributed with RubyGems — "Zev Blut" <rubyzbibd@...>
Hello,
On Dec 18, 2006, at 22:34, Zev Blut wrote:
On Tue, 19 Dec 2006 16:31:48 +0900, Eric Hodel <drbrain@segment7.net>
[#230281] Hpricot and Regular expression — Dhanasekaran Vivekanandhan <mail2sek@...>
Hi All,
[#230287] Re: Please help fixing gems on OSX — Dan Uznanski <vorn@...>
Over the past few months, several people have posted on various mailing
[#230295] string of strings... — Josselin <josselin@...>
I got an array of id's :
On 2006-12-19 09:29:38 +0100, "Martin DeMello" <martindemello@gmail.com> said:
On 19.12.2006 10:23, Josselin wrote:
Robert Klemme wrote:
On 21.12.2006 01:14, David Vallner wrote:
[#230304] Discovering the number of return arguments requested. — Brad Phelan <phelan@...>
Is it possible ( and I think not ) that you can discover if any return
[#230317] Ruby Tidy — Mark Dodwell <seo@...>
Hi All,
[#230328] compare two objects without take its ID in consideration — Lobosque Lucas <floyd_u2@...>
Is there a way to compare two objects without take its ID in
Lobosque Lucas wrote:
On 12/19/06, Jeremy Wells <jwells@servalsystems.co.uk> wrote:
On 12/19/06, Tim Pease <tim.pease@gmail.com> wrote:
It's not particularly nice but you could just do:
[#230329] TkCanvas — Patrick Lynch <lynchnco@...>
Good morning,
[#230349] Division hangs irb — Ashley Moran <work@...>
Anyone know why the first three of these calculations works on my irb
Ashley Moran wrote:
[#230357] help with rdoc stdlib on windows 2000 — tesla <tesla.nicoli@...>
Hi,
[#230378] ruby puzzle: Group candies by unique record fields — Woga Swoga <wogaswoga@...>
I have an list of objects (Candy) and each object has two fields
[#230388] Re: Simple copy of attributes — "Gavin Kistner" <gavin.kistner@...>
From: Trans [mailto:transfire@gmail.com]
[#230420] what exactly does obj.is_a? do? — Jon Garvin <jgarvin.lists@...>
I've got a theory that I hope someone familiar with the deep recesses of
[#230434] class_eval and using a block instead of a String? — Mariano Kamp <mariano.kamp@...>
Hi,
[#230450] ruby gotchas — Mark Guzman <segfault@...>
I've written up some ruby gotchas that have come up while using ruby.
Mark Guzman wrote:
On 12/19/06, Peter Szinek <peter@rubyrailways.com> wrote:
[#230456] Audio conversion in Windows, FLAC to MP3, etc — "djlewis" <djlewis2@...>
Any thoughts on how to do this in Ruby? I've tried hooking to the
[#230476] routine sometimes not returning what i expect — James Cunningham <jameshcunningham@...>
As part of my first-ever submission to the ruby quiz, I wrote
[#230484] run perl script and capture the output — Li Chen <chen_li3@...>
Hi all,
[#230522] how to expect eof with expect+pty — "Simon Strandgaard" <neoneye@...>
using gnupg to encrypt a file with only a passphrase.
[#230535] Ruby Language —
Hi,
[#230548] tricky sort for happy visitors of Paris — Josselin <josselin@...>
all happy visitors of Paris know about the 'arrondissement', an
[#230567] iterator behaviour — Max Russell <thedossone@...>
I have a harness I'm using for testing with Watir. It has become
[#230577] Grabbing quoted substrings — Bil Kleb <Bil.Kleb@...>
OK, I give up, what's the elegant method to
[#230586] Regex question: this should be easy but doesn't work as I expect. — "Sam Kong" <sam.s.kong@...>
Hi all,
[#230588] openssl on Red Hat not installed — Hueen Hueen <hueen@...>
So I'm one of the unlucky ones that don't have openssl properly
Hueen Hueen 叝ta:
Look at the thread form Dec 3
[#230602] Regexp Question: Checking for [joe][/joe] pairs — Joe Peck <joe@...>
Hey, I've got some text in @x and want there to be at least 1 and at
Why are you doing /[\s\d\w]+?/? Just use /.+?/.
Joe Peck wrote:
The problem is I don't want it to accept things like:
[#230636] mechanize 0.6.4 Released — Aaron Patterson <aaron_patterson@...>
mechanize version 0.6.4 has been released!
[#230638] reflecting on objects without creating one — "_Kevin" <kevin.olbrich@...>
Let's say I have two constants
[#230639] Kernel#system bug? — "Charlton" <charlton.wang@...>
Running Ruby 1.8.4 on Linux
[#230647] fxirb-0.3.1: now with .gem and setup.rb — "Martin DeMello" <martindemello@...>
Get it at: http://rubyforge.org/projects/fxirb/
[#230648] Who's maintaining log4r? — jeffz_2002@...
Does anyone know who's maintaining the log4r project? The website at
Hello again folks (if anyone read the last post - busy time of year),
On 12/27/06, jeffz_2002@yahoo.com <jeffz_2002@yahoo.com> wrote:
On Wed, 2007-01-03 at 13:49 +0900, pat eyler wrote:
Thanks for all, folks.
[#230650] Searching Stings with Arrays? — Phil Cooperking <phil@...>
Hi, I've been having a little problem with this. most of my ruby is from
[#230694] ruby-prof doesn't work with ruby/tk? — "fkc_email-news @ yahoo dot com" <fkchang2000@...>
I've tried on several platforms and get the follow error with any tk
[#230697] Common point puzzle — Bil Kleb <Bil.Kleb@...>
Warning: the following really needs a sketch.
[#230720] Symbols vs Strings — matt <matt@...>
Two quick questions:
[#230730] Creating New Objects from REXML::Elements — "eddieroger" <eddieroger@...>
Hello group,
eddieroger wrote:
[#230755] Remove Ruby 1.8.5? — Christopher Latif <christopherl@...>
How do I remove Ruby 1.8.5 from linux? I have built it from source.
M. Edward (Ed) Borasky wrote:
David Vallner wrote:
On 12/21/06, Vincent Fourmond <vincent.fourmond@9online.fr> wrote:
Wilson Bilkovich wrote:
On 12/21/06, Vincent Fourmond <vincent.fourmond@9online.fr> wrote:
Wilson Bilkovich wrote:
[#230760] Matrix class for ruby? -example — seepee <see@...>
On Thu, 21 Dec 2006 09:12:47 +0200, seepee wrote:
[#230769] Chess960 (#106) — Ruby Quiz <james@...>
There are a surprising number of ways to think about this problem, each leading
[#230773] Tree view hierarchy — "Patrick Spence" <djmj12@...>
[#230777] extend weirdness? — "Ian White" <ian.w.white@...>
Hi Group,
[#230792] Method named ***(other) — Julien Gaugaz <gaugaz@...3s.de>
Hi!
>
On 12/21/06, Vidar Hokstad <vidar.hokstad@gmail.com> wrote:
On 12/21/06, Luciano Ramalho <ramalho@gmail.com> wrote:
[#230826] Just starting out, where do I go from here? — Alexander York <s.disparu@...>
This is my first experience with any kind of programming language.
[#230829] Ruby's Trac Alternative — Bil Kleb <Bil.Kleb@...>
So I'm trying to use Trac for our FUN3D development,
On Dec 21, 2006, at 12:55 PM, Bil Kleb wrote:
evanwebb@gmail.com wrote:
Trans wrote:
[#230853] External Ruby Script in HTML — Naked Sushi <runfaster@...>
This probably has a simple answer, but I don't know it.
From: list-bounce@example.com:
On 12/22/06, Pe, Botp <botp@delmonte-phil.com> wrote:
For someone that likes Ruby, Javascript does not matter.
[#230855] Class Variable Confusion — gwtmp01@...
I generally avoid class variables but at the last meeting of the New
Hi --
[#230869] Ruby replacement for ab? — Mat Schaffer <schapht@...>
So I've been hunting for a way to stress test a web application and
On 12/22/06, Mat Schaffer <schapht@gmail.com> wrote:
On Fri, 22 Dec 2006, hemant wrote:
It seems like it would be fairly easy to set up something with
On Fri, 22 Dec 2006, Fred Wulff wrote:
On 12/21/06, khaines@enigo.com <khaines@enigo.com> wrote:
[#230896] |song| Not documented in Pickaxe Book — "Sam'l B" <samlb@...>
Pickaxe Book (2nd Ed.), P. 49, 2nd example, line 3:
Sam'l B wrote:
[#230901] Weird error while reading binary files — Mauricio Kishi <maukishi@...>
Hello everyone!
[#230913] storing values in variables — Vikash Kumar <vikashkumar051@...>
I am using the following code:
[#230941] How to run the new jirb console — Robert Sheehan <r.sheehan@...>
Can someone tell me how to run the new JRuby irb console.
[#230950] class method — Spitfire <timid.gentoo@...>
One thing that I don't understand is the following code.
[#230983] Merry (slightly early) Christmas! Mr. Neighborly's Humble Little Ruby Book is free! — "Jeremy McAnally" <jeremymcanally@...>
Hello all,
Really nice! I'm reading it right now.
This book is really great! I'm familiar with most of the material already,
[#231011] Randomizing an Array? — "jwcooper" <jwcooper@...>
I'm trying to randomize an array, and this is what I have:
jwcooper wrote:
[#231015] Ruby-full debian package — Vincent Fourmond <vincent.fourmond@9online.fr>
[#231040] Ruby and Cygwin — Li Chen <chen_li3@...>
Hi all,
[#231046] Subversion stats on RubyForge — Tom Copeland <tom@...>
They work now!
[#231056] Question: Downloading files with open(-uri)? — Mariano Kamp <mariano.kamp@...>
Hi,
Mariano Kamp wrote:
William James wrote:
[#231072] Help with a ruby idiom — Tim Waters <timgwaters@...>
From the O'Reilly Cookbook there is code that keeps call functions in a
On 23.12.2006 17:02, Tim Waters wrote:
[#231074] A Ruby IDE with GUI capabilities — "JaredAngell@..." <JaredAngell@...>
So far, as far as I can tell, there is no Ruby IDE with GUI
[#231095] ruby-misc (was Re: where have all the experienced users gone?) — "Gerardo Santana Gez Garrido" <gerardo.santana@...>
2006/12/23, Tom Pollard <tomp@earthlink.net>:
[#231108] … unencoding troubles with FeedTools — Robert Jones <jonesieboy@...>
I've hunted around for a solution to this one, but it's really hard to
[#231122] Ruby and SDL? — Wim Vander Schelden <wim.vanderschelden@...>
Hi,
[#231138] Reverting module changes — "Michal Kwiatkowski" <constant.beta@...>
Hi,
[#231160] "su user -c 'command'" from within ruby — Moritz Reiter <mo@...>
Hi,
[#231168] Cropmail 0.9 mail filter — Bertram Scharpf <lists@...>
Hi Rubyists,
Bertram Scharpf wrote:
On 12/24/06, Bertram Scharpf <lists@bertram-scharpf.de> wrote:
[#231181] Hpricot ri and rdoc documentation — "bbiker" <renard@...>
I have gem installed Hpricot-0.4 (mswin32) but no ri documentation or
Eric Hodel wrote:
On Dec 24, 2006, at 17:28, bbiker wrote:
[#231198] A problem about replacing a string in a template. — Kuang Dong <kuangdong@...>
File 1: test.tpl
Kuang Dong wrote:
Andrea Fazzi wrote:
Phrogz wrote:
Andrea Fazzi wrote:
Phrogz wrote:
Phrogz wrote:
[#231216] value returned from code block — Spitfire <timid.gentoo@...>
I've read that in Ruby the value returned from a code block is the
[#231217] including a namespace for just one class — "S. Robert James" <srobertjames@...>
I would like to reference constants and classes defined in module
On Dec 25, 2006, at 12:20 PM, S. Robert James wrote:
[#231224] dynamic changes! — Spitfire <timid.gentoo@...>
These are the sequence of actions I performed in irb.
[#231225] Strange about Array#each_index — Li Chen <chen_li3@...>
Hi all,
[#231255] RubyGems Beta 0.9.0.8 — Eric Hodel <drbrain@...7.net>
Beta version 0.9.0.8 is now available with:
[#231258] windows bat file help needed for rubygems — Eric Hodel <drbrain@...7.net>
How do I get a windows .bat file to return a proper exit code?
On 12/25/06, Eric Hodel <drbrain@segment7.net> wrote:
[#231265] extending Rake with a method rshell — hemant <gethemant@...>
I want to extend Rake with a method rshell, which would enable anyone
On 12/26/06, hemant <gethemant@gmail.com> wrote:
[#231271] Parsing a CSV file having multiple records in RUBYp — Krishna Mundra <krishna_mundra82@...>
Hi everyone,
Hi,
[#231277] Newby - how to round up floating point number? — Dermot Moynihan <der_moyn@...>
Hi guys
-----BEGIN PGP SIGNED MESSAGE-----
Thanks Jeroen.
Dermot Moynihan wrote:
hi,
[#231303] Hash with two identical keys? — "Trans" <transfire@...>
>From Facets' multiton.rb (which is primarily Floran Franks' work), I'm
Looks to me that your keys are arrays.
thanks Ara and Jon,
[#231332] Modified Single Table Inheritance — Ryan Glover <prionscientific@...>
Hello,
[#231336] Object creation with a "variable classname" — "cedric.ch" <cedric.hernalsteens@...>
Hi,
cedric.ch wrote:
[#231341] Peculiar Behavior for a Newby to Undertstand — Charles A Gray <smgspices@...>
I created a class for prime numbers as so:
[#231342] The Programmer Hierarchy — "Trans" <transfire@...>
I hope they know that Ruby isn't a web language...
Jeremy McAnally wrote:
[#231365] reg exp comparison hanging irb — "gaurav bagga" <gaurav.v.bagga@...>
hi,
On 12/27/06, gaurav bagga <gaurav.v.bagga@gmail.com> wrote:
hi simon,
[#231377] How to do TDD in Ruby? — mekondelta <Chris.Melikian@...>
[#231385] newbie with a weird technical problem (@ least I think it's weird) — "will" <will.graduate@...>
Yep, as the post title implies, I'm a newbie. Being a pragmatic newbie
[#231394] Nuby: VisualuRuby, menutest.rb example with check boxes in submenus — "Jason Mayer" <slamboy@...>
I'm back to looking at visualuRuby, have two quick questions about this
[#231406] Problem with win32 change notify, dbi and sql server — "lrlebron@..." <lrlebron@...>
I have created a script to monitor a directory and update a database
On 12/27/06, lrlebron@gmail.com <lrlebron@gmail.com> wrote:
[#231407] Re: Using an UnboundMethod instead of an alias to redefine a method — Pit Capitain <pit@...>
Daniel Berger schrieb:
On Thu, 28 Dec 2006, Pit Capitain wrote:
ara.t.howard@noaa.gov schrieb:
On Thu, 28 Dec 2006, Pit Capitain wrote:
[#231410] Re: Using an UnboundMethod instead of an alias to redefine a method — Mauricio Fernandez <mfp@...>
On Wed, Dec 27, 2006 at 11:30:05PM +0900, Daniel Berger wrote:
[#231417] Contest: fastet way to redefine a method — Pit Capitain <pit@...>
Hi,
On Dec 27, 2006, at 08:59, Pit Capitain wrote:
[#231418] Newbie problem: String can't be coerced into Fixnum — Ja Bo <jbornhoft@...>
I am brand new to Ruby and I would greatly appreciate any help you guys
[#231436] Handling of arbitrary length arrays in arguments to printf builtin — Nick Pavey <nick@...>
Hi Folks,
Nick Pavey wrote:
On 12/27/06, Timothy Hunter <TimHunter@nc.rr.com> wrote:
On 27.12.2006 21:03, Timothy Hunter wrote:
[#231462] Higher-Order Procedures Tutorial (long) — "Nate Murray" <jashmenn@...>
Hey Guys,
On Dec 27, 2006, at 11:11 PM, Giles Bowkett wrote:
On Jan 5, 2007, at 12:36 PM, Jon Egil Strand wrote:
[#231469] override.rb — ara.t.howard@...
[#231494] Strip is not stripping trailing whitespace — Taylor Strait <taylorstrait@...>
I have files with city names which have one or two trailing whitespaces:
Taylor Strait wrote:
[#231522] Syntax for db count query needed — Ruby Quest <kjawaharbabu@...>
can any one tell me the controller syntax for db record count?
[#231551] telling gems where to install... — dc <lister@...>
hi -
[#231552] Re: Last reminder: MountainWest RubyConf Call For Presenters — James Britt <james.britt@...>
pat eyler wrote:
[#231556] Developpers on rails — "Strong Cypher" <cypherstrong@...>
-----BEGIN PGP SIGNED MESSAGE-----
[#231563] unsafe readline(), anything better? — Rob Muhlestein <rmuhlestein@...>
Looking for a combination of readpartial() and readline() in order to
[#231585] Re: Ruby extension issue — Wim Vander Schelden <wim.vanderschelden@...>
I was able to fix the problem by changing my extconf.rb to:
On Dec 28, 2006, at 13:45, Wim Vander Schelden wrote:
[#231595] What we have here is a retard pretending to be a computer scientist — atbusbook@...
http://www.iam.unibe.ch/~scg/Archive/Papers/Scha04bOOEncapsulation.pdf
On Dec 28, 2006, at 16:05, atbusbook@aol.com wrote:
Eric Hodel wrote:
It's a throwback to the C line of languages.
On 29.12.2006 10:36, Neil Wilson wrote:
[#231596] Newbie: Looking for help rounding numbers — Ja Bo <jbornhoft@...>
I can't figure out how to round my answer from this short code that I
[#231599] rubygems install problems (the old ubygems (LoadError) problem. Sigh). — Paul van Delst <Paul.vanDelst@...>
Hello,
On Dec 28, 2006, at 16:30, Paul van Delst wrote:
[#231600] Re: What we have here is a retard pretending to be a computer scientist — "Gennady Bystritsky" <Gennady.Bystritsky@...>
atbusbook@aol.com wrote:
[#231622] Re: newbie: what is ruby's var_dump()? — "Phrogz" <gavin@...>
r wrote:
[#231665] XML - converting from one feed to another (beginner) — rb <rb@...>
I'm trying to read an XML feed of products and convert them to a
[#231671] Word Search (#107) — Ruby Quiz <james@...>
The three rules of Ruby Quiz:
[#231672] Another Q: find behavior — "Krekna Mektek" <krekna@...>
Hi,
[#231674] Rails install question — "Robert Hicks" <sigzero@...>
I get this and I am wondering if it "hurts" anything:
[#231686] how to properly format data when using TCPSocket.send() — Nathan Taylor <onebitcipher@...>
It would be greatly appreciated if someone would clue me in to what I am
On 29.12.2006 18:44, Nathan Taylor wrote:
Robert Klemme wrote:
[#231702] rcodetools 0.4.0: TDD++, automagic assertions, 100% accurate completion, doc/code browsing... — Mauricio Fernandez <mfp@...>
Mauricio Fernandez wrote:
On Sat, Dec 30, 2006 at 04:42:45AM +0900, Hemant Kumar wrote:
[#231713] Does eql? do a deep comparison of objects? — Wes Gamble <weyus@...>
If I have two objects A and B where each is of the same type but have
[#231726] Methods validating their arguments: good or bad? — Michael Judge <mjudge@...>
Michael Judge wrote:
[#231751] how to make a curly... — Jernej Grecki <nejcslo@...>
Well I just started with ruby and in irb, i just cant fint the right
Jernej Grecki wrote:
[#231763] how to lex javascript for an assert_js system? — Phlip <phlip2005@...>
Ruboids:
On 12/30/06, Phlip <phlip2005@nogmailspam.com> wrote:
[#231785] Proposal to create a new mailing list — Daniel Schierbeck <daniel.schierbeck@...>
Hello fellow Rubyphilics!
On Sun, Dec 31, 2006 at 01:07:38AM +0900, Daniel Schierbeck wrote:
I think Daniel Schierbeck really wanted is to take n00b-caring off
On Dec 30, 2006, at 10:07 AM, Daniel Schierbeck wrote:
[#231801] Little Things — "Trans" <transfire@...>
I was a bit surprised about Matz mention of the little things in his
I mostly agree, with some of the additions of course being more
Hi --
Trans wrote:
On 12/31/06, Devin Mullins <twifkak@comcast.net> wrote:
On 12/31/06, Rob Sanheim <rsanheim@gmail.com> wrote:
On 2006/12/31, at 07:38, Rob Sanheim wrote:
On Thu, 4 Jan 2007, [ISO-8859-1] Paulo Kh wrote:
On 1/3/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
Hi --
On 1/3/07, dblack@wobblini.net <dblack@wobblini.net> wrote:
Hi --
On Thu, 4 Jan 2007, Trans wrote:
On Thu, 4 Jan 2007, Trans wrote:
Hi --
On Thu, 4 Jan 2007 dblack@wobblini.net wrote:
ara.t.howard@noaa.gov wrote:
Trans wrote:
On Thu, 4 Jan 2007, Trans wrote:
Hi --
On Fri, 5 Jan 2007 dblack@wobblini.net wrote:
Hi --
On Fri, 5 Jan 2007 dblack@wobblini.net wrote:
On 1/4/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Fri, 5 Jan 2007, Trans wrote:
On 1/4/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Fri, 5 Jan 2007, Tim Pease wrote:
On 1/4/07, ara.t.howard@noaa.gov <ara.t.howard@noaa.gov> wrote:
On Sat, 6 Jan 2007, Gregory Brown wrote:
On Fri, 5 Jan 2007, Trans wrote:
Chris Carter wrote:
Hi,
Yukihiro Matsumoto wrote:
[#231818] how to use a variable reference another variable? — Haofei Wang <yuesefa@...>
since variable names are not objects, is there any possible ways to do
[#231821] Newbie: It works, how can I make it better? — Jay Bornhoft <jbornhoft@...>
I wrote this little prog giving the user two choices.
[#231859] odd 'include' behaviour? — "has" <has.temp3@...>
Wondering if the following behaviour is a bug or a feature:
[#231876] Stupid Ruby Tricks — "Chris Carter" <cdcarter@...>
Hey guys,
Firstly, I appologize if this question has already been answered but I =
[#231886] ERb Request — matt <matt@...>
Could someone point me to the ERb Homepage, or whom I need to email to
[#231907] Ruby Profiler and ruby-prof Issues break working code? — "Tyler Prete" <psyonic@...>
I wrote some Ruby code to solve a little puzzle (
[#231938] Re: Status of Cardinal (was Re: Proposal to create a new mailing list) — "Francis Cianfrocca" <garbagecat10@...>
I'm not jumping back into this in a big way, since it's obvious
On 12/31/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
On 12/31/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
[#231941] Mini-RCR: Extra Argument for Array#join — James Edward Gray II <james@...>
I've been looking at the to_sentence() method in Rails. It's
On 1/3/07, Trans <transfire@gmail.com> wrote:
[#231946] Open source credit card processing in ruby — snacktime <snacktime@...>
Just recently I have the option to open source a credit card
On 12/31/06, M. Edward (Ed) Borasky <znmeb@cesmail.net> wrote:
On 12/31/06, Francis Cianfrocca <garbagecat10@gmail.com> wrote:
On 12/31/06, cremes.devlist@mac.com <cremes.devlist@mac.com> wrote:
[#231951] Re: Status of Cardinal (was Re: Proposal to create a new mailing list) — Charles Oliver Nutter <charles.nutter@...>
Robert Dober wrote:
On 12/31/06, Charles Oliver Nutter <charles.nutter@sun.com> wrote:
Robert Dober wrote:
Charles Oliver Nutter wrote:
On 1/2/07, Charles Oliver Nutter <charles.nutter@sun.com> wrote:
[#231965] Introducing Xaggly, a C-based XML Parser for Ruby — "Tony Perrie" <xaggly@...>
I have written a C-based XML parser as a ruby plugin. I managed to
Tony Perrie wrote:
Re: Symbols vs Strings
matt wrote:
> 1) Could someone expand on what a symbol is?
Ridiculously long explanation follows. Composed of all the answers from
some previous symbol vs string thread.
h1. On Symbols
*So, I've been blindly typing things like "attr_accessor :elephant" and
"link_to :action => 'hemorrhage'" for a while, and I've started to get
annoyed with that colon syntax. Somebody told me that :elephant and
:hemorrhage are Symbols, but I've no clue what that is or means. WTF, mate?*
Symbol. That's the name of the class. We can see that this way:
a = :foo
a.class #=> Symbol
Yes, see, Symbols are objects, and can be treated like objects. You can
point variables to them, you can pass them as parameters, you can return
them from blocks and methods, and you can invoke methods on them.
They're quite simple, really.
*Uhhh.... I was, sort of, looking for more information than that.*
Well, there's a veritable cornucopia of ways in which I can attempt to
share the essense of Symbol with you. First, there is the source code to
the Ruby interpreter, which is, of course, the authoritative source on
this matter. And /as/ the One True Source is the Ruby source code, what
follows is a list of descriptions, analogies, observations, and
generalizations of symbols that attempt to communicate as much of their
being as you desire to know, without communicating their being in whole.
Note: Nobody can learn you but yourself. These words attempt to provide
facts, explanations and perspectives that may help you on your journey
to understanding Symbols -- but you /will/ have to do some work on your
own, whether that be experimentation in irb, or deep, pensive
introspection of the meaning of programming. To quote [a translation of]
<a href="http://en.wikiquote.org/wiki/Plutarch">Plutarch</a>:
<blockquote>We must encourage [each other] -- once we have grasped the
basic points -- to interconnecting everything else on our own, to use
memory to guide our original thinking, and to accept what someone else
says as a starting point, a seed to be nourished and grow. For the
correct analogy for the mind is not a vessel that needs filling but wood
that needs igniting -- no more -- and then it motivates one towards
originality and instills the desire for truth. Suppose someone were to
go and ask his neighbors for fire and find a substantial blaze there,
and just stay there continually warming himself: that is no different
from someone who goes to someone else to get to some of his rationality,
and fails to realize that he ought to ignite his own flame, his own
intellect, but is happy to sit entranced by the lecture, and the words
trigger only associative thinking and bring, as it were, only a flush to
his cheeks and a glow to his limbs; but he has not dispelled or
dispersed, in the warm light of philosophy, the internal dank gloom of
his mind.</blockquote>
*Gawsh, that sounds dangerous.*
It's really not. I just put that disclaimer in there to weed out the
slackers. I'll also add, that to properly glean information from this
page, you should already understand:
* Object-oriented programming
* The "variables are references" way of programming that infuses Ruby
* Many other aspects of Ruby, such as what attr_accessor does.
*All right, then. So... what _are_ these "many ways" to teach me about
Symbols?*
Yeah, right. Thanks. They are:
1. A list of the Symbol's basic properties.
1. Example code for their common usages, a discussion of the
similarities and differences between symbols and their substitutes, and
why symbols exist.
1. An analogy to concepts from other programming languages.
1. A list of some important implementation details behind symbols.
1. When you might *not* want to use Symbols (I know, blasphemy).
1. The gory details of their implementation.
1. Links to other explanations.
You can pick and choose from this menu as you like. And away we go!
*Wow, you know what I just realized? The scrollbox on the right is
frikkin' tiny. This document is huge! I don't want to read all this.*
Well, you should've thought of that before you decided not to understand
Symbols. Also, you can stop reading as soon as you understand Symbols
(but not a second earlier).
h2. A list of the symbols basic properties.
A Symbol literal, in code, is a colon followed by a bare word (/\w+/, in
general, though the regex is in fact more complex than this -- see the
gory implementation details if you really care).
A Symbol's properties can be summed up thusly:
:apple == :apple &&
:apple.to_s == 'apple' &&
:apple.to_i == 23417
:apple is A literal reference to a Symbol object, just as 5 is a literal
reference to the number 5, and "garden" is a literal reference to the
eponymous String object. I wouldn't worry too much about asking what
:apple is "wrapping" or whatnot -- :apple is :apple, as is evident from
line 1.
Line 1 says that we can compare Symbols using the == operator (aka
Symbol#==). The == operator returns true whenever the literal references
look the same (that is, in the source code, :apple is :apple is :apple,
but not :donkey or even :APPLE).
*So a Symbol literal is no different a String literal, eh?*
False. Yeah, it looks like that, but it there are a lot of ways in which
it isn't. For one, Strings come with methods galore, like gsub and slice
and capitalize. Symbol comes with:
===, id2name, inspect, to_i, to_int, to_s, to_sym
You really can't do a whole lot with Symbols, and you're not supposed to.
*So Symbols are just Strings with all the useful methods removed?*
No. Take away Symbol#id2name, Symbol#to_s, and Symbol#to_i and you still
have something useful to Rubyists -- the ability to test for equality.
Here, Symbols look like strings only to the programmer. To the program,
they look like boring, ineffectual objects with which you can do nothing
but test for equality.
*So is that _all_ you can do with a Symbol?*
Well, equality is a big one, and covers many standard usages of Symbols
in Ruby. See the Examples section for details.
You can also convert a Symbol to a String. While Symbols aren't Strings,
they have a close bond with the String class, partly due to Symbol#to_s.
This returns a new String containing whatever you typed following the
colon. (It, of course, does not affect the original object. Short of <a
href="http://rubyforge.org/cgi-bin/viewcvs.cgi/evil/lib/evil.rb?root=evil&view=markup">evil.rb</a>,
Ruby code cannot change the class of a given object.)
You can also convert a Symbol to an Integer. (To be honest, I'm not
quite sure if it's useful to anybody. I've never used it, certainly.)
According to the rdoc on Symbol#to_i, :apple.to_i will equal 23417 for
the life of my Ruby program, no matter how many times I type it. Go
ahead, pop open an irb window and try it out.
As a matter of fact, try all of these things out in irb. Set variables
equal to symbols, pass them to methods and blocks, invoke some methods,
go crazy!
So, you should see, by now, that you can't do a lot with Symbols. You
can reference them through the funny :goatee syntax, you can compare
them for equality, and you can convert them to Strings and Integers.
(Truth be told, you can do a few other things, but they fall out of the
99.9% of use cases for Symbols. After understanding Symbols, peruse the
section on [non-gory] implementation details for more.)
*Okay, that made no sense.*
Well, give it a think some more, or try one of the other sections. I
don't mind; I'm just an HTML document after all.
*No, I mean, if symbols don't /do/ anything, then why the <expletive
deleted> have them in the language in the first place?*
Well, read the next section.
h2. Example code for their common usages, a discussion of the
similarities and differences between symbols and their substitutes, and
why symbols exist.
Symbols are typically used where identity is concerned. Yeah, I know
that's vague. Here's some specific cases:
* Referring to variable or method names
* As keys to a Hash (often when doing that named parameter trick, as
in Rails)
* To refer to a specific set of things, such as :up, :right, :left, :down.
Now let's get down and dirty with real raw code, for each of these in turn:
# Referring to variable or method names
class MyJob
attr_writer :frustration_level #refers to the method names to be created
def print_var(sym)
puts "#{sym} = #{instance_variable_get(sym)}" #refers to the
variable name to be accessed
end
end
java_code = MyJob.new
java_code.frustration_level = "bordering on suicide"
java_code.print_var(:@frustration_level)
# As keys to a Hash (often when doing that named parameter trick, as
in Rails)
connection = { :host => 'eat.mcdonalds.com', :port => 443 } #as keys
to a hash
link_to :action => 'free_willy' #that named parameter trick
def link_to(hashy_thing) #implementing that named parameter trick
do_something_with(hashy_thing[:action])
end
# To refer to a specific set of things, such as :up, :right, :left, :down.
class Pos
attr_accessor :x, :y #looks familiar...
def initialize(x,y) @x,@y = x,y end
def move(dir)
case dir
when :up then @y += 1
when :down then @y -= 1
when :left then @x -= 1
when :right then @x += 1
end
self #return self to make irb sessions friendlier, and to allow
chaining, i suppose
end
end
pos = Pos.new(0,0) #x = 0, y = 0
pos.move :up #x = 0, y = 1
pos.move :left #x = -1, y = 1
Take some time. Read through the code slowly. Swish it around in your
mouth. Change some things and see what happens. Employ irb. Now pause.
Okay. Understand?
*Wait, why do attr_accessor and instance_variable_get require colons in
front of your identifiers, while alias and defined? do not?*
alias and defined? are reserved Ruby keywords. The Ruby parser notices
the keyword, and knows that the next token better be a method/variable
name, or else.
attr_accessor and instance_variable_get, however, are not reserved Ruby
keywords. They are built-in methods, provided through the Kernel module.
Because they are methods, the syntax for invoking them is the same as
for invoking any other method. If you were to do:
attr_writer frustration_level
Ruby would first look for a local variable named 'frustration_level',
and then, failing that, invoke the 'frustration_level' method on self,
and passing the *return value* to attr_writer (or, more likely, a
NoMethodError will whizz by). We don't want that. Instead, we're using
Symbols as a pretty way to pass in the _name_ of the method we want to
create. We pass [a reference to] the Symbol into attr_accessor, and then
attr_accessor invokes #to_s to find out what you typed after the colon.
Okay, do you understand /now/?
*Well, I think so, but -- couldn't you have just used Strings everywhere
for the same purpose? And for the move up/down thing, you could have
just created some UP = 1, DOWN = 2 style constants, or, heck, make four
different methods -- move_up, move_down, etc.!*
Yes, I could have.
*Uh... ?*
For all of the above cases (and all of the ways in which I've seen
Symbols applied), you could use Strings in their place. This is because,
well, what are we doing? We're comparing for equality (as with the case
statement, or the Hash access), or we're calling #to_s to find out its
name (as with the attr_accessor thing). These are both things we can do
with Strings.
So why use Symbols instead?
1. To signal intent. By sticking colons in front of these bare words,
you're saying, "These are the absolutes in my code. These are the things
that do not change. In my application, these are not messages to the
user, tokens to parse for, or anything else that's String-like. These
are *concepts*."
2. (On a related note...) For readability's sake. If you're using a
text editor with syntax highlighting, the advantage of saying <%=
link_to :controller => 'dingleberry', :action => 'pick' %> over <%=
link_to 'controller' => 'dingleberry', 'action' => 'pick' %>, amidst a
sea of RHTML, is IMMEDIATELY obvious (no pun intended, Ruby veterans).
Even if you're not, using symbols in the right places can still aid your
eyes in knowing where to look, and reduce line noise.
3. Slight performance improvement. In cases like the above, where a
fixed number of symbols are used over and over, you can get a slight
performance improvement using Symbols rather than Strings. In a typical
application, it's more likely to be negligable. Also, there seem to be
cases where using Symbols is the slightly *less* performant thing to do,
so I wouldn't dwell on this bullet much.
4. Because they're cool, and all the cool Ruby cats are doing it. Be
careful about this one, too, as there are many cases where Symbols don't
make sense. No Golden Hammer For You.
As for the UP = 1 / DOWN = 2, move_up / move_down suggestions: well,
that's just icky.
h2. An analogy to concepts from other programming languages.
So your brain doesn't think in pure Ruby, yet? That's a shame. It's
really a fun experience.
Ruby's symbols are most analagous to Lisp's symbols, I'm told. They are
also comparable to Java's interned Strings (available through the
String.intern() method), but chances are you haven't heard of
String.intern(), so I doubt that'll gain you much insight.
What might be more useful, rather, is to compare their usages to similar
things you'd be doing in other languages, like, oh, C or Java.
*Java:*
Where as attr_accessor method could take a String or a Symbol, the
Reflection API in Java uses Strings as parameters for method names,
so... yeah, that's that one.
The equivalent of the above Hash example would likely be Strings as keys
to Map (or Map-like) objects. This is the case for Properties and
ServletRequest.getParameters(), for example, and using the Properties
class is often a trick you might employ to pass freeform configuration
lists into your *own* methods.
The up/down/left/right thing general has quite an odeous parallel in
Java 1.4:
class Pos {
static public final UP = 1;
static public final DOWN = 2;
static public final LEFT = 3;
static public final RIGHT = 4;
...
Ouch. Java 5 added enums, so, you know, less pain.
*C:*
The Reflection API in C -- ha! Just kidding. Had you for a second, though.
As for the Hash thing... It's been so long since I've coded C, I just
don't know... what would the replacement for a Hash be? (C++, I'd
imagine, has some STL map class.) Named parameters just don't get used
-- ever -- leading to potentially cryptic code.
The up/down/left/right thing would most likely be accomplished using an
enum. This isn't too bad, but it's anti-Ruby. Why? Because it's
contractual. It requires a static and unchanging list of enum values to
be declared before an enum can be used. Ruby's free-flowing -- the above
#move method would not blink an eye if passed :sideways or
:out_of_the_way or :to_the_beat as a parameter.
h2. A list of some important implementation details behind symbols.
Yeah, so there are some things you might want to know about Ruby's
symbols before you go applying them willy-nilly. In no particular order:
* Symbols are immutable. Ha! Actually, you should already know that,
by virtue of the fact that Symbol's method list doesn't have any
mutating methods on it. (Compare String#replace and String#gsub!, for
example.)
* Symbols are immediate. They share this property with Fixnums, true,
false, and nil. In Ruby terms:
3.times { puts :streisand.object_id } #=> 6625550, 6625550, 6625550
3.times { puts "yogi bera".object_id } #=> 23531092, 23531068,
23531044
puts :streisand.object_id #=> 6625550
See? Each time you reference a String literal, you're creating a new
one, while each time you reference a Symbol (or any other immediate
object), you're referring to the same one that was created the *first*
time you referenced it.
* You can reference symbols in a couple of other ways. If you want
more than just variable name syntax for your symbols, you can reference
a symbol using :'single quotes' or :"double quotes" as such.
* You can also get access to Symbols _dynamically_, too. As an
extension of the last bullet, you can actually /interpolate/ the
double-quoted symbols in the :"normal #{fashion}". You can also get a
reference to a Symbol from its given String representation using
String#intern or String#to_sym. These should both be used with strong
caution because...
* Symbols are never garbage collected. For most cases, this isn't a
problem. You'll have maybe a hundred or so tiny little symbols floating
around in memory (thanks to their immediacy), and getting touched quite
often. However, if you're pulling Symbols out of your hat dynamically,
then you're juggling gas-torched batons. This, for example, leaks a
thousand symbols:
1000.times {|i| :"number #{i}" }
* At runtime, you can see a list of all the Symbols that have been
sprung into existence, by typing Symbol.all_symbols (returns an Array of
Symbols).
* :bananorama.to_yaml produces a different result from
'bananorama'.to_yaml.
h2. When you might *not* want to use Symbols.
As pointed out earlier, the principal benefit of using Symbols over
Strings is to give your mind and eyes a little less work to do in
figuring out the intent of a given piece of code. Likewise, if what
you're really doing is preparing a message for the user, or doing
something else String-like, maybe you want to stick with Strings.
Bad use of symbols:
num = [:one, :two][rand(2)]
puts "Your number is: #{num}"
Better to use Strings, instead:
num = ['one', 'two'][rand(2)] #or %w{one two} if you'd like
puts "Your number is: #{num}"
h2. The gory details of their implementation.
For now, don your flame-retardant suit, and visit <a
href="http://ruby-talk.org/cgi-bin/vframe.rb/ruby/ruby-talk/172818?172638-173519+split-mode-vertical">this
thread</a>. I'm too lazy/incompetent to type up a summary of this wizardry.
h2. Links to other explanations.
If none of my descriptions helped, well, then, too bad. Or, you can
click some links.
The following explanations are not necessarily universally condoned by
the Ruby community, but may fit your fancy (for what it's worth):
"Symbols as light-weight
Strings":http://moonbase.rydia.net/mental/blog/programming/ruby-symbols-explained.html
"Symbols as Integers with human faces":[ruby-talk:173442]
"Symbols as ever-present bubbles floating in an imperceptible
ether":[ruby-talk:173076]
Devin