# Ruby

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

[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:** 1310

---

## [.each do |foo, bar| what does bar do?](https://www.ruby-forum.com/t/each-do-foo-bar-what-does-bar-do/118217)

<div class="topic-metadata">

**Author:** [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Replies:** 26\
**Last updated:** [November 1, 2007, 1:29am UTC](https://www.ruby-forum.com/t/each-do-foo-bar-what-does-bar-do/118217 "2007-11-01T01:29:37Z")

</div>

“code\_words.each do |real, code| idea.gsub!( real, code ) end You see the each method? The each method is all over in Ruby. It’s available for Arrays, Hashes, even Strings. Here, our code\_words dictionary is kept in…

---

## [Why, or when to, use a class method?](https://www.ruby-forum.com/t/why-or-when-to-use-a-class-method/118875)

<div class="topic-metadata">

**Author:** [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Replies:** 5\
**Last updated:** [November 1, 2007, 1:03am UTC](https://www.ruby-forum.com/t/why-or-when-to-use-a-class-method/118875 "2007-11-01T01:03:30Z")

</div>

Here’s the example: Jukeboxes charge money for each song played, not by the minute. That makes short songs more profitable than long ones. We may want to prevent songs that take too long from being available on the So…

---

## [Cant seem to get system() & pipe to work together](https://www.ruby-forum.com/t/cant-seem-to-get-system-pipe-to-work-together/118349)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 10\
**Last updated:** [November 1, 2007, 12:32am UTC](https://www.ruby-forum.com/t/cant-seem-to-get-system-pipe-to-work-together/118349 "2007-11-01T00:32:22Z")

</div>

I am trying to run a command line utility which converts a wma file to a mp3 (i want to be able to do this for batch files) using FFMpeg & LAME. I am trying to run the following command from ruby: “C:\\Documents and Se…

---

## [Generation of initialize](https://www.ruby-forum.com/t/generation-of-initialize/117130)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 12\
**Last updated:** [November 1, 2007, 12:14am UTC](https://www.ruby-forum.com/t/generation-of-initialize/117130 "2007-11-01T00:14:50Z")

</div>

Hi everyone, I’m new to Ruby. I’m looking for an elegant solution to a simple problem. I have some classes like this one in my code: class A attr\_reader :a1, a2 def initialize(a1, a2) @a1 = a1 @a2 = a2 end end …

---

## [How to include a external class file for creating a new obje](https://www.ruby-forum.com/t/how-to-include-a-external-class-file-for-creating-a-new-obje/118884)

<div class="topic-metadata">

**Author:** [@newrubyuser](https://www.ruby-forum.com/u/newrubyuser)\
**Replies:** 0\
**Last updated:** [October 31, 2007, 11:59pm UTC](https://www.ruby-forum.com/t/how-to-include-a-external-class-file-for-creating-a-new-obje/118884 "2007-10-31T23:59:20Z")

</div>

hello all Im new to ruby and im just trying to see how i can instanciate an object that is defined in a class file like myclass.rb then in another class file like start.rb i just call it like so, newObj = myclass.new …

---

## [Find out the mac address](https://www.ruby-forum.com/t/find-out-the-mac-address/118818)

<div class="topic-metadata">

**Author:** [@flnative](https://www.ruby-forum.com/u/flnative)\
**Replies:** 7\
**Last updated:** [October 31, 2007, 7:28pm UTC](https://www.ruby-forum.com/t/find-out-the-mac-address/118818 "2007-10-31T19:28:14Z")

</div>

Hi @all How can I find out the mac address from the default gateway with a ruby script? Does exist any methods to read it out? The script runs on a linux distribution… thanks for your comment!

---

## [Ruby and Swing: Profligacy](https://www.ruby-forum.com/t/ruby-and-swing-profligacy/118865)

<div class="topic-metadata">

**Author:** [@headius](https://www.ruby-forum.com/u/headius)\
**Replies:** 0\
**Last updated:** [October 31, 2007, 7:17pm UTC](https://www.ruby-forum.com/t/ruby-and-swing-profligacy/118865 "2007-10-31T19:17:43Z")

</div>

Profligacy is a JRuby/Swing framework created by Zed S… It takes a different approach from the previously posted Cheri, in that it doesn’t try to hide the Swing API. Instead, it just provides solutions for some of the…

---

## [Array and ASCII Help needed](https://www.ruby-forum.com/t/array-and-ascii-help-needed/118746)

<div class="topic-metadata">

**Author:** [@Hiato\_X](https://www.ruby-forum.com/u/Hiato_X)\
**Replies:** 12\
**Last updated:** [October 31, 2007, 4:22pm UTC](https://www.ruby-forum.com/t/array-and-ascii-help-needed/118746 "2007-10-31T16:22:32Z")

</div>

Hello there, I have just recently started Ruby (because it is such a beautiful language) and was just about two things (NOTE: I have a very strong Delphi background so the code may not be the Ruby way of ding things…

---

## [Code to DRY](https://www.ruby-forum.com/t/code-to-dry/118780)

<div class="topic-metadata">

**Author:** [@micheldogger](https://www.ruby-forum.com/u/micheldogger)\
**Replies:** 8\
**Last updated:** [October 31, 2007, 4:00pm UTC](https://www.ruby-forum.com/t/code-to-dry/118780 "2007-10-31T16:00:27Z")

</div>

This is a simplified version of the problem I have. I work with “ordered” classes, i.e. having a method a.le?(b) (le = lower or equal). But I want two constants MIN and MAX, same for all classes, with MIN.le?(a) == tr…

---

## [What's in YOUR Ruby? Could Ruby ever be a g.p. dev language?](https://www.ruby-forum.com/t/whats-in-your-ruby-could-ruby-ever-be-a-g-p-dev-language/118347)

<div class="topic-metadata">

**Author:** [@CodeToad](https://www.ruby-forum.com/u/CodeToad)\
**Replies:** 12\
**Last updated:** [October 31, 2007, 3:49pm UTC](https://www.ruby-forum.com/t/whats-in-your-ruby-could-ruby-ever-be-a-g-p-dev-language/118347 "2007-10-31T15:49:45Z")

</div>

Hi Folks, I just finished my first 40+ hours with plain old Ruby (without rails for now), and I love this stuff!! Everyone relates it to smalltalk, and that seems mostly true. Being a Certified Old Dude (and sometim…

---

## [Anyone going to RubyConf](https://www.ruby-forum.com/t/anyone-going-to-rubyconf/118612)

<div class="topic-metadata">

**Author:** [@nielsene](https://www.ruby-forum.com/u/nielsene)\
**Replies:** 3\
**Last updated:** [October 31, 2007, 2:09pm UTC](https://www.ruby-forum.com/t/anyone-going-to-rubyconf/118612 "2007-10-31T14:09:30Z")

</div>

So who’s going to RubyConf in Charlotte, NC on Friday? I’d love to meet some of the people on the list if you are going to be around, and hear about what projects you are getting into. Want to meet up for a beer/sod…

---

## [Re: Can we define data types explicitly?](https://www.ruby-forum.com/t/re-can-we-define-data-types-explicitly/118830)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [October 31, 2007, 2:06pm UTC](https://www.ruby-forum.com/t/re-can-we-define-data-types-explicitly/118830 "2007-10-31T14:06:00Z")

</div>

You can use is\_a? or there is kind\_of? and instance\_of? methods so you could test as follows arr.each do |a| if a.is\_a? Integer #do stuff here end end You can also use this in a case construct. the ‘Integer’ is t…

---

## [Why, oh, why, little regexp?](https://www.ruby-forum.com/t/why-oh-why-little-regexp/118793)

<div class="topic-metadata">

**Author:** [@dewie](https://www.ruby-forum.com/u/dewie)\
**Replies:** 14\
**Last updated:** [October 31, 2007, 2:02pm UTC](https://www.ruby-forum.com/t/why-oh-why-little-regexp/118793 "2007-10-31T14:02:30Z")

</div>

‘cost \* tax’.match(/(\[a-z\]+)\*/).to\_a =\> \[“cost”, “cost”\] Why? I’m reading it as… Take one or more characters between a and z, store them into a back reference, then repeat the previous match zero or more times. Now…

---

## [Error with mysql install](https://www.ruby-forum.com/t/error-with-mysql-install/118481)

<div class="topic-metadata">

**Author:** [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Replies:** 1\
**Last updated:** [October 31, 2007, 12:08pm UTC](https://www.ruby-forum.com/t/error-with-mysql-install/118481 "2007-10-31T12:08:08Z")

</div>

when i install mysql, i get the following error Select which gem to install for your platform (i386-mswin32) mysql 2.7.3 (mswin32) mysql 2.7.1 (mswin32) mysql 2.7 (ruby) mysql 2.6 (ruby) Skip this gem Cancel installat…

---

## [Better way to accumulate totals](https://www.ruby-forum.com/t/better-way-to-accumulate-totals/118782)

<div class="topic-metadata">

**Author:** [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Replies:** 6\
**Last updated:** [October 31, 2007, 10:17am UTC](https://www.ruby-forum.com/t/better-way-to-accumulate-totals/118782 "2007-10-31T10:17:08Z")

</div>

I am just learning RUBY and am very impressed, I one week I’ve built tree routines that will save my group 6 to 7 hours each week, and they run in 2 minutes. Pretty cool. I would appreciate a suggest on how to do some…

---

## [Alias\_method allows illegal identifier name](https://www.ruby-forum.com/t/alias-method-allows-illegal-identifier-name/118811)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 3\
**Last updated:** [October 31, 2007, 9:41am UTC](https://www.ruby-forum.com/t/alias-method-allows-illegal-identifier-name/118811 "2007-10-31T09:41:30Z")

</div>

e$B$O$8$a$^$7$Fe(J alias\_method e$B$G!"?7$7$$L\>A0$K\<1JL;R$H$7$F$OIT@5$Je(J e$BJ8;zNs$rEO$7$F$b!"JLL\>Dj5A$G$-$F$7$^$$$^$9e(J e$B$b$A$m$s%3!\<%k$G$-$^$;$s$,e(J $ cat e.rb module M def m() end alias\_method “\\t\\n”, :m …

---

## [Win32ole type casting possible?](https://www.ruby-forum.com/t/win32ole-type-casting-possible/118609)

<div class="topic-metadata">

**Author:** [@danmcb](https://www.ruby-forum.com/u/danmcb)\
**Replies:** 1\
**Last updated:** [October 31, 2007, 9:28am UTC](https://www.ruby-forum.com/t/win32ole-type-casting-possible/118609 "2007-10-31T09:28:03Z")

</div>

Hello all, I have a problem when I try to automate an application using Rubys win32ole class. I’ll try to explain my problem by some simplified sample code: oleObj = WIN32OLE.new( 'Some.COM.application' ) foo = oleOb…

---

## [Find the closest items in an array to a given value](https://www.ruby-forum.com/t/find-the-closest-items-in-an-array-to-a-given-value/118661)

<div class="topic-metadata">

**Author:** [@trebor777](https://www.ruby-forum.com/u/trebor777)\
**Replies:** 15\
**Last updated:** [October 31, 2007, 8:55am UTC](https://www.ruby-forum.com/t/find-the-closest-items-in-an-array-to-a-given-value/118661 "2007-10-31T08:55:54Z")

</div>

Hi! I’m searching for a light method for finding the closest items to a given value. example/ 1…10 in a range i give, 5.5, return 5 and 6 for example… as i’m working with arrays, containing numbers, but with n…

---

## [Email address for Huihoo site (http://www.huihoo.com/)?](https://www.ruby-forum.com/t/email-address-for-huihoo-site-http-www-huihoo-com/118547)

<div class="topic-metadata">

**Author:** [@randy\_k](https://www.ruby-forum.com/u/randy_k)\
**Replies:** 7\
**Last updated:** [October 31, 2007, 8:36am UTC](https://www.ruby-forum.com/t/email-address-for-huihoo-site-http-www-huihoo-com/118547 "2007-10-31T08:36:02Z")

</div>

Does anyone have an email address for the Huihoo site (http://www.huihoo.com/) or the owner of the site? I found their summary of Ruby Syntax, and the first part was helpful to me, but there are some what I’ll call …

---

## [RUBY DRY to replace 6 lines in 1](https://www.ruby-forum.com/t/ruby-dry-to-replace-6-lines-in-1/118757)

<div class="topic-metadata">

**Author:** [@Josselin](https://www.ruby-forum.com/u/Josselin)\
**Replies:** 16\
**Last updated:** [October 31, 2007, 8:05am UTC](https://www.ruby-forum.com/t/ruby-dry-to-replace-6-lines-in-1/118757 "2007-10-31T08:05:37Z")

</div>

I have a group of lines (used in Googlemaps display) based on 2 arrays : zl = 9 if farthest\_proposition.distance\_to(origin) \< = 25.0 zl = 10 if farthest\_proposition.distance\_to(origin) \<= 15.0 zl = 11 if farthest\_p…

---

## [Ruby Lex Specification](https://www.ruby-forum.com/t/ruby-lex-specification/118732)

<div class="topic-metadata">

**Author:** [@vascoas](https://www.ruby-forum.com/u/vascoas)\
**Replies:** 6\
**Last updated:** [October 31, 2007, 7:45am UTC](https://www.ruby-forum.com/t/ruby-lex-specification/118732 "2007-10-31T07:45:44Z")

</div>

Hi, Where can i find a ruby (1.8.6) syntax specification? If that specification means a file in the source, no problem for me. Thanks, Vasco Andrade e Silva

---

## [Problems with mechanize and fields embedded in tables](https://www.ruby-forum.com/t/problems-with-mechanize-and-fields-embedded-in-tables/118770)

<div class="topic-metadata">

**Author:** [@Todd\_ASJacobs](https://www.ruby-forum.com/u/Todd_ASJacobs)\
**Replies:** 5\
**Last updated:** [October 31, 2007, 5:25am UTC](https://www.ruby-forum.com/t/problems-with-mechanize-and-fields-embedded-in-tables/118770 "2007-10-31T05:25:00Z")

</div>

I’m working with the following versions: ruby 1.8.2 libwww-mechanize-ruby 0.6.10 and have run across an odd problem. One site that I’m trying to scrape has started embedding form fields inside of tables, and mec…

---

## [(BitTorrent-related) binary "string" to hexadecimal?](https://www.ruby-forum.com/t/bittorrent-related-binary-string-to-hexadecimal/118804)

<div class="topic-metadata">

**Author:** [@sbraford](https://www.ruby-forum.com/u/sbraford)\
**Replies:** 3\
**Last updated:** [October 31, 2007, 3:05am UTC](https://www.ruby-forum.com/t/bittorrent-related-binary-string-to-hexadecimal/118804 "2007-10-31T03:05:56Z")

</div>

Hello, Let’s say one were “hypothetically”, and that’s a big hypothetical there, writing a BitTorrent tracker in ruby… Quick Synopsis: I’ve got the SHA1 hexdigest of a .torrent metainfo file saved on the server. Cli…

---

## [Newbie Question on Operator Precedence?](https://www.ruby-forum.com/t/newbie-question-on-operator-precedence/118800)

<div class="topic-metadata">

**Author:** [@Z\_T](https://www.ruby-forum.com/u/Z_T)\
**Replies:** 2\
**Last updated:** [October 31, 2007, 2:41am UTC](https://www.ruby-forum.com/t/newbie-question-on-operator-precedence/118800 "2007-10-31T02:41:35Z")

</div>

I need your help to understand the output of this program. puts false or true #----\> output is false. OR does not get evaluated? if false or true then puts ‘then’ #----\> output is ‘then’. OR gets evaluated! else…

---

## [Re: better way to accumulate totals](https://www.ruby-forum.com/t/re-better-way-to-accumulate-totals/118798)

<div class="topic-metadata">

**Author:** [@robkuz](https://www.ruby-forum.com/u/robkuz)\
**Replies:** 0\
**Last updated:** [October 31, 2007, 1:21am UTC](https://www.ruby-forum.com/t/re-better-way-to-accumulate-totals/118798 "2007-10-31T01:21:23Z")

</div>

Thank you for the very clear and helpful explanation! Robert K. removed\_email\_address@domain.invalid ----- Original Message ---- From: 7stud – removed\_email\_address@domain.invalid To: ruby-talk ML removed\_email\_add…

---

## [Is there a usenet library for Ruby?](https://www.ruby-forum.com/t/is-there-a-usenet-library-for-ruby/118791)

<div class="topic-metadata">

**Author:** [@maz](https://www.ruby-forum.com/u/maz)\
**Replies:** 2\
**Last updated:** [October 31, 2007, 12:06am UTC](https://www.ruby-forum.com/t/is-there-a-usenet-library-for-ruby/118791 "2007-10-31T00:06:35Z")

</div>

Is there a Ruby library to communicate with a usenet server? I did a bit of googling and found nothing but I’m hoping people here will me more privy to such information. Thank you…

---

## [Problem with socket.recv()](https://www.ruby-forum.com/t/problem-with-socket-recv/118654)

<div class="topic-metadata">

**Author:** [@frankiefoo](https://www.ruby-forum.com/u/frankiefoo)\
**Replies:** 12\
**Last updated:** [October 30, 2007, 10:47pm UTC](https://www.ruby-forum.com/t/problem-with-socket-recv/118654 "2007-10-30T22:47:04Z")

</div>

Hi everyone, I’m currently developing a Ruby TCP client and have a problem with socket.recv(). After establishing a connection with my server, I exchange a couple of messages until the server begins to do some calcul…

---

## [Performance: system() vs. Garbage Collection or Thread Count](https://www.ruby-forum.com/t/performance-system-vs-garbage-collection-or-thread-count/118754)

<div class="topic-metadata">

**Author:** [@jazcyk](https://www.ruby-forum.com/u/jazcyk)\
**Replies:** 4\
**Last updated:** [October 30, 2007, 10:35pm UTC](https://www.ruby-forum.com/t/performance-system-vs-garbage-collection-or-thread-count/118754 "2007-10-30T22:35:54Z")

</div>

Hi, I have a performance problem with the following setup: I use a Ruby script to run a Java stress-test tool (JMeter) using Kernel.system(). The Ruby part is responsible for building configuration files for JMeter, l…

---

## [Looking for a conf ticket](https://www.ruby-forum.com/t/looking-for-a-conf-ticket/118774)

<div class="topic-metadata">

**Author:** [@James\_Cox](https://www.ruby-forum.com/u/James_Cox)\
**Replies:** 0\
**Last updated:** [October 30, 2007, 8:59pm UTC](https://www.ruby-forum.com/t/looking-for-a-conf-ticket/118774 "2007-10-30T20:59:21Z")

</div>

Hey, it looks like my options for tickets have fallen thru… yet i’m still gonna be making it (who doesn’t like to fly and hang out in a different country? :)) therefore if anyone misses their plane, gets deathly ill,…

---

## [PostgreSQL-Ruby extention: calling Postgres functions](https://www.ruby-forum.com/t/postgresql-ruby-extention-calling-postgres-functions/118764)

<div class="topic-metadata">

**Author:** [@htrex](https://www.ruby-forum.com/u/htrex)\
**Replies:** 1\
**Last updated:** [October 30, 2007, 8:46pm UTC](https://www.ruby-forum.com/t/postgresql-ruby-extention-calling-postgres-functions/118764 "2007-10-30T20:46:29Z")

</div>

Hi all, I’m quite new to Ruby, and I have a question: I’m using the Postgres-ruby extention to connect to my Postgres db (require ‘postgres’ etc) Now I need to call existing db functions but I don’t know how… the fu…

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

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