# Ruby

**URL:** https://www.ruby-forum.com/c/ruby/7.md?page=1351

[Latest](https://www.ruby-forum.com/latest.md) · [Categories](https://www.ruby-forum.com/categories.md) · [Tags](https://www.ruby-forum.com/tags.md)

**Page:** 1352

---

## [A 'require' question](https://www.ruby-forum.com/t/a-require-question/81279)

<div class="topic-metadata">

**Author:** [@bbiker](https://www.ruby-forum.com/u/bbiker)\
**Replies:** 7\
**Last updated:** [September 25, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/a-require-question/81279 "2007-09-25T22:50:40Z")

</div>

When you have multiple versions of a gem, “require ‘gemxxx’” loads in the latest version. How can you specify a specific version (or some other constraint)? The ri documentation for require is of no help. Kernel#req…

---

## [Newbie question about sets](https://www.ruby-forum.com/t/newbie-question-about-sets/82514)

<div class="topic-metadata">

**Author:** [@jasonmorrison](https://www.ruby-forum.com/u/jasonmorrison)\
**Replies:** 7\
**Last updated:** [September 25, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/newbie-question-about-sets/82514 "2007-09-25T22:50:40Z")

</div>

I’m just curious if there’s any way to duplicate values in a set. After quiz 108, I modified my submission so that it was a fully functional game. I then passed around my finished program to some of my coworkers who …

---

## [A most undangerous Hash#store!](https://www.ruby-forum.com/t/a-most-undangerous-hash-store/81335)

<div class="topic-metadata">

**Author:** [@Trans](https://www.ruby-forum.com/u/Trans)\
**Replies:** 31\
**Last updated:** [September 25, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/a-most-undangerous-hash-store/81335 "2007-09-25T22:50:30Z")

</div>

Hi– Think I need a better name for this method. It is anything but dangerous. Any ideas? As with #store but adds the key/value pair only if the key isn’t already in the hash. def store!(key, value) unless key?(key) …

---

## [RCR again (Integer#succ!, Integer#pred!)](https://www.ruby-forum.com/t/rcr-again-integer-succ-integer-pred/82615)

<div class="topic-metadata">

**Author:** [@flatekmonkey](https://www.ruby-forum.com/u/flatekmonkey)\
**Replies:** 13\
**Last updated:** [September 25, 2007, 10:50pm UTC](https://www.ruby-forum.com/t/rcr-again-integer-succ-integer-pred/82615 "2007-09-25T22:50:19Z")

</div>

I am definitely in an RCR mood :wink: Well as I was reading the archives and Jim W.'s guidlines I saw an accepted RCR for Integer#odd? Integer#even? I always define Integer#pred for myself it seems so trivial that I d…

---

## [Merge YARV](https://www.ruby-forum.com/t/merge-yarv/80853)

<div class="topic-metadata">

**Author:** [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Replies:** 31\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/merge-yarv/80853 "2007-09-25T22:49:29Z")

</div>

Hi, I’ll commit YARV to Ruby Subversion repository. Sorry for being late. Current implementation (/trunk) will be copied to /branches/matzruby ChangeLog file of YARV will be copied to doc/ChangeLog-YARV I have never …

---

## [Can anyone try to solve this problems?](https://www.ruby-forum.com/t/can-anyone-try-to-solve-this-problems/82558)

<div class="topic-metadata">

**Author:** [@cyrusg](https://www.ruby-forum.com/u/cyrusg)\
**Replies:** 21\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/can-anyone-try-to-solve-this-problems/82558 "2007-09-25T22:49:24Z")

</div>

Hi to everybody. I am trying to solve these three problems in Ruby. I do not know if my solutions are really correct. I just wanted to ask help, if somebody can show their solutions. I would appreciated your help. W…

---

## [Removing Ruby success stories page from Ruby-lang.org](https://www.ruby-forum.com/t/removing-ruby-success-stories-page-from-ruby-lang-org/81240)

<div class="topic-metadata">

**Author:** [@rahul](https://www.ruby-forum.com/u/rahul)\
**Replies:** 40\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/removing-ruby-success-stories-page-from-ruby-lang-org/81240 "2007-09-25T22:49:11Z")

</div>

The list of ruby success stories page in ruby-lang.org is really lame. compared to python success stories link this looks very weak. i think this should be removed till the list looks a bit more impressive

---

## [Little Things](https://www.ruby-forum.com/t/little-things/80732)

<div class="topic-metadata">

**Author:** [@Trans](https://www.ruby-forum.com/u/Trans)\
**Replies:** 121\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/little-things/80732 "2007-09-25T22:49:11Z")

</div>

I was a bit surprised about Matz mention of the little things in his last ketynote. Little things can make all the difference! In fact, long time Rubyists have been waiting a long for some important “little” things. H…

---

## [WWW::Mechanize problem](https://www.ruby-forum.com/t/www-mechanize-problem/82568)

<div class="topic-metadata">

**Author:** [@splattael](https://www.ruby-forum.com/u/splattael)\
**Replies:** 3\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/www-mechanize-problem/82568 "2007-09-25T22:49:07Z")

</div>

Hello, I could not yet figure out how to work around this problem: agent = WWW::Mechanize.new page = agent.get(“http://www.amazon.com/”) search\_form = page.forms.with.name(“site-search”).first search\_form.field-keyw…

---

## [What does this mean? ||=](https://www.ruby-forum.com/t/what-does-this-mean/81754)

<div class="topic-metadata">

**Author:** [@jkay](https://www.ruby-forum.com/u/jkay)\
**Replies:** 9\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/what-does-this-mean/81754 "2007-09-25T22:49:06Z")

</div>

I’m looking at this method and don’t understand what ||= means: def current\_account @account ||= Account.find(session\[:account\_id\]) end I have the ruby for rails book and can’t find anything on it.

---

## [Fastthread 0.6.2](https://www.ruby-forum.com/t/fastthread-0-6-2/82646)

<div class="topic-metadata">

**Author:** [@MenTaLguY](https://www.ruby-forum.com/u/MenTaLguY)\
**Replies:** 4\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/fastthread-0-6-2/82646 "2007-09-25T22:49:06Z")

</div>

It looks like I got too creative in 0.6.1 and consequently ran afoul of a bug in the Ruby interpreter. 0.6.2 works around the bug and should be entirely stable at this point. Thanks to Young H. for his help in coming…

---

## [Net/pop error in Ruby 1.9](https://www.ruby-forum.com/t/net-pop-error-in-ruby-1-9/82345)

<div class="topic-metadata">

**Author:** [@Masaki\_S](https://www.ruby-forum.com/u/Masaki_S)\
**Replies:** 3\
**Last updated:** [September 25, 2007, 10:49pm UTC](https://www.ruby-forum.com/t/net-pop-error-in-ruby-1-9/82345 "2007-09-25T22:49:02Z")

</div>

e$B=uED$G$9!#e(B Net::POP3.start e$B$Ge(B NoMethodError e$B$,$G$^$9!#e(B $ cat x.rb require ‘net/pop’ pwd = ‘XXXXX’ Net::POP3.start( ‘SERVER’, 110, ‘USER’, pwd ) do |ses| end $ ruby19 x.rb /usr/local/lib/ruby/1.9…

---

## [Reading Data from a Website](https://www.ruby-forum.com/t/reading-data-from-a-website/82346)

<div class="topic-metadata">

**Author:** [@anon1m0us](https://www.ruby-forum.com/u/anon1m0us)\
**Replies:** 10\
**Last updated:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/reading-data-from-a-website/82346 "2007-09-25T22:48:45Z")

</div>

Hi; No clue how to do this. My program to go to a website and read data and process it. Don’t kow where to even begin! How do I go to a website in RUBY? How to I start reading the data?

---

## [Finding path to ruby script argument](https://www.ruby-forum.com/t/finding-path-to-ruby-script-argument/82626)

<div class="topic-metadata">

**Author:** [@mhinton](https://www.ruby-forum.com/u/mhinton)\
**Replies:** 10\
**Last updated:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/finding-path-to-ruby-script-argument/82626 "2007-09-25T22:48:41Z")

</div>

When I execute a ruby script by the following: ruby helloworld.rb onlyarg How can I find what equals? For example, in Windows, ruby C:\\scripts\\helloworld.rb onlyarg helloworld.rb: What can I put here to display the …

---

## [Rcodetools 0.4.1 (TDD++, automagic assertions, accurate comp](https://www.ruby-forum.com/t/rcodetools-0-4-1-tdd-automagic-assertions-accurate-comp/82479)

<div class="topic-metadata">

**Author:** [@tulkas](https://www.ruby-forum.com/u/tulkas)\
**Replies:** 2\
**Last updated:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/rcodetools-0-4-1-tdd-automagic-assertions-accurate-comp/82479 "2007-09-25T22:48:36Z")

</div>

rcodetools is a collection of Ruby code manipulation tools. It includes xmpfilter and editor-independent Ruby development helper tools, as well as emacs and vim interfaces. Currently, rcodetools comprises: xmpfilte…

---

## [Lockfile-1.4.1](https://www.ruby-forum.com/t/lockfile-1-4-1/81208)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/lockfile-1-4-1/81208 "2007-09-25T22:48:36Z")

</div>

URLS http://rubyforge.org/projects/codeforpeople/ http://codeforpeople.com/lib/ruby/lockfile/ SYNOPSIS lib/lockfile.rb : a ruby library for creating NFS safe lockfiles bin/rlock : ruby command line tool which uses t…

---

## [Cloning object with array members](https://www.ruby-forum.com/t/cloning-object-with-array-members/81288)

<div class="topic-metadata">

**Author:** [@Shea\_M](https://www.ruby-forum.com/u/Shea_M)\
**Replies:** 7\
**Last updated:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/cloning-object-with-array-members/81288 "2007-09-25T22:48:35Z")

</div>

Consider a simple class like this: class MyClass def initialize @var1 = ‘’ @arr1 = \[\] end end Now if I have an instance of MyClass, and want to clone it, what is the ‘cleanest’ way to do this? a = MyClass.new b…

---

## [Local variable assertion](https://www.ruby-forum.com/t/local-variable-assertion/82556)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 9\
**Last updated:** [September 25, 2007, 10:48pm UTC](https://www.ruby-forum.com/t/local-variable-assertion/82556 "2007-09-25T22:48:02Z")

</div>

I’ve started studying Ruby, and while I like it, one thing that bothers me is that there is not a way to explicitly declare a variable in order to say “I want a variable local to this scope: I don’t want to reuse some…

---

## [Yaml.rb and YAML "%" directives](https://www.ruby-forum.com/t/yaml-rb-and-yaml-directives/82627)

<div class="topic-metadata">

**Author:** [@Joshua\_Choi](https://www.ruby-forum.com/u/Joshua_Choi)\
**Replies:** 1\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/yaml-rb-and-yaml-directives/82627 "2007-09-25T22:47:59Z")

</div>

I’m new to Ruby, and it really is fun. Right now, I’m playing with YAML… …but one part of yaml.rb doesn’t seem to work–it doesn’t seem to recognize any % directives (http://yaml.org/spec/current.html#id2523453) like …

---

## [Curb problems on OS X](https://www.ruby-forum.com/t/curb-problems-on-os-x/82354)

<div class="topic-metadata">

**Author:** [@lists](https://www.ruby-forum.com/u/lists)\
**Replies:** 4\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/curb-problems-on-os-x/82354 "2007-09-25T22:47:54Z")

</div>

Hi, Is anyone else having problems with curb \<http://curb.rubyforge.org/ on OS X using Intel architecture? Just thought I’d check before filing a bug. $ ruby --version ruby 1.8.5 (2006-08-25) \[i686-darwin8.8.2\] …

---

## [Why is there a seperate Math class?](https://www.ruby-forum.com/t/why-is-there-a-seperate-math-class/81427)

<div class="topic-metadata">

**Author:** [@arachnd](https://www.ruby-forum.com/u/arachnd)\
**Replies:** 22\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/why-is-there-a-seperate-math-class/81427 "2007-09-25T22:47:37Z")

</div>

Why does everything have to be Math.(num)? Isn’t num.func more object oriented-ish? For example: (Math.methods - Object.methods).select {|x| Math.method(x).arity == 1}.each do |x| ?\> Numeric.class\_eval { ?\> …

---

## [Case when](https://www.ruby-forum.com/t/case-when/81201)

<div class="topic-metadata">

**Author:** [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Replies:** 10\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/case-when/81201 "2007-09-25T22:47:33Z")

</div>

In all examples I can see in my book about ‘case …’ ‘when…’ 'then… ’ there is only one statement after the ‘when…’ I understand using ‘then’ if the statement is on the same line as ‘when’, BUT can I write multiple s…

---

## [Extract array values when using Object.send?](https://www.ruby-forum.com/t/extract-array-values-when-using-object-send/82524)

<div class="topic-metadata">

**Author:** [@warhero](https://www.ruby-forum.com/u/warhero)\
**Replies:** 2\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/extract-array-values-when-using-object-send/82524 "2007-09-25T22:47:27Z")

</div>

How can I take an array, extract each top level value when using Object.send on an object?.. See the example below… class TestSend def test( arg1, arg2, arg3) puts arg1 puts arg2 puts arg3 end end t = TestSend.n…

---

## [Class.new?](https://www.ruby-forum.com/t/class-new/83349)

<div class="topic-metadata">

**Author:** [@warren](https://www.ruby-forum.com/u/warren)\
**Replies:** 11\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/class-new/83349 "2007-09-25T22:47:21Z")

</div>

The interpreter lets me make this mistake: class Act def Act.new # Anything, really end end Coding your own “new” just seems to screw things up. What is it good for and why isn’t it a syntax error? Fred

---

## [Problem with open-uri](https://www.ruby-forum.com/t/problem-with-open-uri/82609)

<div class="topic-metadata">

**Author:** [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Replies:** 5\
**Last updated:** [September 25, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/problem-with-open-uri/82609 "2007-09-25T22:47:20Z")

</div>

Hi ! I’m unable to open certain URIs with open-uri. Here is the code : require ‘rexml/document’ require ‘open-uri’ xml = REXML::Document.new(open(“http://myoms.net/soap/oms2.wsdl”)) The error I get is : /usr/lib/ru…

---

## [How can I do this better?](https://www.ruby-forum.com/t/how-can-i-do-this-better/81229)

<div class="topic-metadata">

**Author:** [@ssk](https://www.ruby-forum.com/u/ssk)\
**Replies:** 15\
**Last updated:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/how-can-i-do-this-better/81229 "2007-09-25T22:46:59Z")

</div>

Hi, I find myself to use the following idiom frequently. def foo i return @cache\[i\] if @cache\[i\] @cache\[i\] = some\_method\_that\_takes\_long\_time(i) end I like the post-modifying if statement. But I feel uncomfortable…

---

## [Return\_on](https://www.ruby-forum.com/t/return-on/81608)

<div class="topic-metadata">

**Author:** [@Trans](https://www.ruby-forum.com/u/Trans)\
**Replies:** 23\
**Last updated:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/return-on/81608 "2007-09-25T22:46:59Z")

</div>

Sometimes i do this: return x if x Anyway to code it as: return\_on x t.

---

## [Rake test help](https://www.ruby-forum.com/t/rake-test-help/81746)

<div class="topic-metadata">

**Author:** [@jefers](https://www.ruby-forum.com/u/jefers)\
**Replies:** 3\
**Last updated:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/rake-test-help/81746 "2007-09-25T22:46:50Z")

</div>

Hi, I am having difficulty using rake to run tests on a gem I have created. I am able to run the tests I have created from the command line individually without problem, but when I try to run through rake it cannot l…

---

## [RCR Opinion Poll](https://www.ruby-forum.com/t/rcr-opinion-poll/82587)

<div class="topic-metadata">

**Author:** [@flatekmonkey](https://www.ruby-forum.com/u/flatekmonkey)\
**Replies:** 6\
**Last updated:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/rcr-opinion-poll/82587 "2007-09-25T22:46:46Z")

</div>

Hi all there is one thing concerning enumerations I really would like to file a CR about. But I guess it is necessary to open my ears and listen to your POVs before doing so. I believe that similar things are alread…

---

## [Eval defaulting to binding](https://www.ruby-forum.com/t/eval-defaulting-to-binding/82408)

<div class="topic-metadata">

**Author:** [@PeSSSSaS\_Botp](https://www.ruby-forum.com/u/PeSSSSaS_Botp)\
**Replies:** 2\
**Last updated:** [September 25, 2007, 10:46pm UTC](https://www.ruby-forum.com/t/eval-defaulting-to-binding/82408 "2007-09-25T22:46:01Z")

</div>

Hi, sometimes (or many times), i put some debugging lines in my code. something like, C:\\family\\ruby\>cat -n debugger.rb 1 #----------------- 2 # debugger.rb 3 #----------------- 4 5 DEBUG\_MACRO\_1=‘puts “FILE:…

[Previous page](https://www.ruby-forum.com/c/ruby/7.md?page=1350)

[Next page](https://www.ruby-forum.com/c/ruby/7.md?page=1352)
