# Ruby

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

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

---

## [Named Constructor Idiom in Ruby?](https://www.ruby-forum.com/t/named-constructor-idiom-in-ruby/112410)

<div class="topic-metadata">

**Author:** [@unnali](https://www.ruby-forum.com/u/unnali)\
**Replies:** 5\
**Last updated:** [August 20, 2007, 11:56am UTC](https://www.ruby-forum.com/t/named-constructor-idiom-in-ruby/112410 "2007-08-20T11:56:45Z")

</div>

Hi all, I’m almost certain there’s a good way to do this, but I seem to have lost hold of the thought of how – is there a straight-forward/neat way to do the named constructor idiom in Ruby? In C++ terms, a class lik…

---

## [Ruby's equivalent to Java's "interface"](https://www.ruby-forum.com/t/rubys-equivalent-to-javas-interface/112440)

<div class="topic-metadata">

**Author:** [@steveeq1](https://www.ruby-forum.com/u/steveeq1)\
**Replies:** 6\
**Last updated:** [August 20, 2007, 10:10am UTC](https://www.ruby-forum.com/t/rubys-equivalent-to-javas-interface/112440 "2007-08-20T10:10:58Z")

</div>

Please forgive this rather naive question, but it’s a query that’s difficult to search for on google. In java, you can program to interface. IE, in java, you can do: public interface QuakeBehavior { public void quack…

---

## [Setter of $!](https://www.ruby-forum.com/t/setter-of/112389)

<div class="topic-metadata">

**Author:** [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Replies:** 10\
**Last updated:** [August 20, 2007, 10:06am UTC](https://www.ruby-forum.com/t/setter-of/112389 "2007-08-20T10:06:58Z")

</div>

e$B!!$5$5$@$G$9!#e(B e$B!!e(BYARV e$B$G$NET9g\>e!"e(B$! e$B$re(B readonly e$B$K$7$?$$$s$G$9$,!“NI$$$G$7$g$&$+!#e(B e$B=PMh$J$$$H:$$kNc$H$+$C$F$I$l$/$i$$$”$k$G$7$g$&$+!#e(B

---

## [Fastest CSV parsing?](https://www.ruby-forum.com/t/fastest-csv-parsing/112254)

<div class="topic-metadata">

**Author:** [@williej](https://www.ruby-forum.com/u/williej)\
**Replies:** 8\
**Last updated:** [August 20, 2007, 10:06am UTC](https://www.ruby-forum.com/t/fastest-csv-parsing/112254 "2007-08-20T10:06:58Z")

</div>

This is the best I’ve come up with so far. It should handle any CSV record (i.e., fields may contain commas, double quotes, and newlines). class String def csv if include? ‘"’ ary = “#{chomp},”.scan( /\\G"(\[^"\](?:…

---

## ['Rite'](https://www.ruby-forum.com/t/rite/112469)

<div class="topic-metadata">

**Author:** [@Trans](https://www.ruby-forum.com/u/Trans)\
**Replies:** 3\
**Last updated:** [August 20, 2007, 8:28am UTC](https://www.ruby-forum.com/t/rite/112469 "2007-08-20T08:28:49Z")

</div>

So has the name ‘Rite’ for Ruby 2.0 officially gone the way of the Dodo bird? I’m curious to know b/c I have a little web generation tool that I think the name ‘rite’ would suite (b/c of the alliteration to ‘write’).…

---

## [How can I open a local file?](https://www.ruby-forum.com/t/how-can-i-open-a-local-file/112483)

<div class="topic-metadata">

**Author:** [@Zhan\_feng\_W](https://www.ruby-forum.com/u/Zhan_feng_W)\
**Replies:** 1\
**Last updated:** [August 20, 2007, 4:24am UTC](https://www.ruby-forum.com/t/how-can-i-open-a-local-file/112483 "2007-08-20T04:24:31Z")

</div>

Hi,friends, how can I get the path of a local file, so that I can open and read the file? in my webpage I have following: Select A File: And e.g. I will get the fname=“/home/wym/exdir/ruby/f…

---

## [Adding to an array question](https://www.ruby-forum.com/t/adding-to-an-array-question/112435)

<div class="topic-metadata">

**Author:** [@visage](https://www.ruby-forum.com/u/visage)\
**Replies:** 3\
**Last updated:** [August 20, 2007, 3:56am UTC](https://www.ruby-forum.com/t/adding-to-an-array-question/112435 "2007-08-20T03:56:29Z")

</div>

I need to add a string to the end of an array count number of times. I was wondering if I could get some advice on the prefered way to do it in Ruby. @bucket is the array def add\_person(count, name) @bucket += Array…

---

## [Getting MySQL column comment metadata?](https://www.ruby-forum.com/t/getting-mysql-column-comment-metadata/112461)

<div class="topic-metadata">

**Author:** [@Mario\_TSL](https://www.ruby-forum.com/u/Mario_TSL)\
**Replies:** 4\
**Last updated:** [August 20, 2007, 3:54am UTC](https://www.ruby-forum.com/t/getting-mysql-column-comment-metadata/112461 "2007-08-20T03:54:19Z")

</div>

Hi All, How do I go about getting the “Comments” metadata–the one I type via MySQL Administrator, for example–associated with a MySQL column? I have been able to pull metadata from both ActiveRecord and DBI but canno…

---

## [RubyConf 2007: proposal deadline extended](https://www.ruby-forum.com/t/rubyconf-2007-proposal-deadline-extended/112480)

<div class="topic-metadata">

**Author:** [@David\_ASBlack](https://www.ruby-forum.com/u/David_ASBlack)\
**Replies:** 1\
**Last updated:** [August 20, 2007, 2:16am UTC](https://www.ruby-forum.com/t/rubyconf-2007-proposal-deadline-extended/112480 "2007-08-20T02:16:23Z")

</div>

Hi – We’ve extended the deadline for presentation proposals for RubyConf 2007. There were some DNS problems and glitches… so it seems like a good idea to add a few days. The new deadline is August 23, 5PM, EDT. Let …

---

## [Launchy 0.2.1 Released](https://www.ruby-forum.com/t/launchy-0-2-1-released/112430)

<div class="topic-metadata">

**Author:** [@jeremyheiler](https://www.ruby-forum.com/u/jeremyheiler)\
**Replies:** 2\
**Last updated:** [August 20, 2007, 1:35am UTC](https://www.ruby-forum.com/t/launchy-0-2-1-released/112430 "2007-08-20T01:35:21Z")

</div>

launchy version 0.2.1 has been released. http://copiousfreetime.rubyforge.org/launchy/ Launchy is helper class for launching cross-platform applications in a fire and forget manner. There are application concepts …

---

## [Kevin Howe?](https://www.ruby-forum.com/t/kevin-howe/112462)

<div class="topic-metadata">

**Author:** [@Trans](https://www.ruby-forum.com/u/Trans)\
**Replies:** 3\
**Last updated:** [August 20, 2007, 1:06am UTC](https://www.ruby-forum.com/t/kevin-howe/112462 "2007-08-20T01:06:20Z")

</div>

Last call for Kevin Howe. Hello? T.

---

## [Trunk/test/ruby/test\_eval.rb](https://www.ruby-forum.com/t/trunk-test-ruby-test-eval-rb/112475)

<div class="topic-metadata">

**Author:** [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Replies:** 0\
**Last updated:** [August 20, 2007, 12:39am UTC](https://www.ruby-forum.com/t/trunk-test-ruby-test-eval-rb/112475 "2007-08-20T00:39:18Z")

</div>

e$B!!$5$5$@$G$9!#e(B e$B!!e(Bmake test-all TESTS=ruby/test\_eval e$B$,\<:GT$7$^$9!#e(BFixnum e$B$d$ie(B NilClass e$B$d$ie(B + instance\_eval + class e$BJQ?t$"$?$j$N5sF0$i$7$$$N$G$9e(B e$B$,!"2?$,$I$&$^$:$$$N$+$h$/$o$+$…

---

## [Float addition problem / Processor bug?](https://www.ruby-forum.com/t/float-addition-problem-processor-bug/112466)

<div class="topic-metadata">

**Author:** [@clauer](https://www.ruby-forum.com/u/clauer)\
**Replies:** 7\
**Last updated:** [August 19, 2007, 11:32pm UTC](https://www.ruby-forum.com/t/float-addition-problem-processor-bug/112466 "2007-08-19T23:32:13Z")

</div>

Hi, Check out this weird IRB output: === START === irb(main):001:0\> a = 2.95 + 2.95 + 2.95 =\> 8.85 irb(main):002:0\> puts 8.85 - a -1.77635683940025e-15 =\> nil === END === I’m running “ruby 1.8.6 (2007-06-07 patc…

---

## [Video playback library?](https://www.ruby-forum.com/t/video-playback-library/112468)

<div class="topic-metadata">

**Author:** [@jjrussell](https://www.ruby-forum.com/u/jjrussell)\
**Replies:** 7\
**Last updated:** [August 19, 2007, 11:18pm UTC](https://www.ruby-forum.com/t/video-playback-library/112468 "2007-08-19T23:18:12Z")

</div>

I’ve recently begun learning ruby (coming from a mainly java world), and so far I really like it. Now I’m trying to write as much as I can using ruby so I can get a better feel for the language. So, I have an upcomin…

---

## [8086 simulator in ruby](https://www.ruby-forum.com/t/8086-simulator-in-ruby/112358)

<div class="topic-metadata">

**Author:** [@vvangelovski](https://www.ruby-forum.com/u/vvangelovski)\
**Replies:** 21\
**Last updated:** [August 19, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/8086-simulator-in-ruby/112358 "2007-08-19T20:08:51Z")

</div>

I’m thinking of writing a simulator for the intel 8086 processor in ruby. At first I’m interested in implementing basic instruction execution and memory access, no interrupts. The interface may later be implemented wi…

---

## [Filesystem Database](https://www.ruby-forum.com/t/filesystem-database/112369)

<div class="topic-metadata">

**Author:** [@yottameter](https://www.ruby-forum.com/u/yottameter)\
**Replies:** 10\
**Last updated:** [August 19, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/filesystem-database/112369 "2007-08-19T19:51:50Z")

</div>

I’d like to use a database, but my IT department won’t install mysql. I know perl has a db interface that is stored on the filesystem. Is FSDB the equivalent for Ruby? Is that what people recommend using for db’s stor…

---

## [YAML and NArray](https://www.ruby-forum.com/t/yaml-and-narray/112417)

<div class="topic-metadata">

**Author:** [@danmcb](https://www.ruby-forum.com/u/danmcb)\
**Replies:** 1\
**Last updated:** [August 19, 2007, 3:46pm UTC](https://www.ruby-forum.com/t/yaml-and-narray/112417 "2007-08-19T15:46:26Z")

</div>

In the past week, I’ve been exploring a little problem that by Wednesday I was ready to sit down and code. Now, the details of the problem aren’t important, but for this problem I was going to need to have objects th…

---

## [Array Difference](https://www.ruby-forum.com/t/array-difference/112352)

<div class="topic-metadata">

**Author:** [@fire-fly](https://www.ruby-forum.com/u/fire-fly)\
**Replies:** 6\
**Last updated:** [August 19, 2007, 1:26pm UTC](https://www.ruby-forum.com/t/array-difference/112352 "2007-08-19T13:26:11Z")

</div>

Hi all. Why this don’t work?? Begin code class Prova attr\_accessor :n def initialize(n) @n = n end def to\_s “#{@n}” end def ==(other) @n == other.n end end p1 = \[Prova.new(1), Prova.new(2)\] p2 = \[Prova.new(…

---

## [Labrador-0.1 beta release (+ longish Release Note)](https://www.ruby-forum.com/t/labrador-0-1-beta-release-longish-release-note/112454)

<div class="topic-metadata">

**Author:** [@flatekmonkey](https://www.ruby-forum.com/u/flatekmonkey)\
**Replies:** 0\
**Last updated:** [August 19, 2007, 11:38am UTC](https://www.ruby-forum.com/t/labrador-0-1-beta-release-longish-release-note/112454 "2007-08-19T11:38:55Z")

</div>

Hi list I just released my first beta version of Labrador, renamed as “The Lazy Programmer’s Best Friend” http://rubyforge.org/projects/labrador/ Enjoy. ------------------------------------ 8\< #\* Labrador, The Lazy…

---

## [Lambda {|(v0,v1),v2|}.call(\[1\],2)](https://www.ruby-forum.com/t/lambda-v0-v1-v2-call-1-2/112388)

<div class="topic-metadata">

**Author:** [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Replies:** 7\
**Last updated:** [August 19, 2007, 9:30am UTC](https://www.ruby-forum.com/t/lambda-v0-v1-v2-call-1-2/112388 "2007-08-19T09:30:47Z")

</div>

e$B0J2\<$NNc$Oe(B ArgumentError e$B$K$J$j$^$;$s!#e(B % ./ruby -ve ‘lambda {|(v0,v1),v2| p \[v0,v1,v2\]}.call(\[1\],2)’ ruby 1.9.0 (2007-08-18 patchlevel 0) \[i686-linux\] \[1, nil, 2\] \[ruby-dev:29616\] e$B$rEv$F$kA0$Ne(B matz…

---

## [Download Calvin+Hobbes Script](https://www.ruby-forum.com/t/download-calvin-hobbes-script/112438)

<div class="topic-metadata">

**Author:** [@curi](https://www.ruby-forum.com/u/curi)\
**Replies:** 9\
**Last updated:** [August 19, 2007, 8:26am UTC](https://www.ruby-forum.com/t/download-calvin-hobbes-script/112438 "2007-08-19T08:26:41Z")

</div>

The top link on del.icio.us is a site with all the Calvin + Hobbes strips. I thought I’d download them before they get taken down. Here’s the code if you want, it’s very short. Newer people can also see how easy it is…

---

## [Is this the perfect regex for validating first & last names?](https://www.ruby-forum.com/t/is-this-the-perfect-regex-for-validating-first-last-names/112423)

<div class="topic-metadata">

**Author:** [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Replies:** 12\
**Last updated:** [August 19, 2007, 6:52am UTC](https://www.ruby-forum.com/t/is-this-the-perfect-regex-for-validating-first-last-names/112423 "2007-08-19T06:52:36Z")

</div>

Perhaps a fairly bold statement, coming from a novice regex’er. :slight\_smile: I’m creating a form (php) and have conjoured up this regex. My objective with this regex is to be sure I get a valid person’s name. With…

---

## [Trunk/test/ruby/test\_proc.rb:127](https://www.ruby-forum.com/t/trunk-test-ruby-test-proc-rb-127/112393)

<div class="topic-metadata">

**Author:** [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Replies:** 2\
**Last updated:** [August 19, 2007, 6:15am UTC](https://www.ruby-forum.com/t/trunk-test-ruby-test-proc-rb-127/112393 "2007-08-19T06:15:34Z")

</div>

e$B!!$5$5$@$G$9!#e(B e$B!!$3$N%F%9%H$G$9$,!"e(B0 e$B$K$J$k$Y$-$J5$$,$9$k$s$G$9$,$=$&$G$b$J$$$G$7$ge(B e$B$&$+!#$3$N7o$K$D$$$F$N5DO@$,8+$D$+$i$J$+$C$?$N$G!"65$($F$b$i$($J$$$Ge(B e$B$7$g$&$+!#e(B trunk/test/ruby/test\_…

---

## [SEGV: def m() yield \[\] end; m(&lambda {|\*v| p v})](https://www.ruby-forum.com/t/segv-def-m-yield-end-m-lambda-v-p-v/112422)

<div class="topic-metadata">

**Author:** [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Replies:** 3\
**Last updated:** [August 19, 2007, 5:05am UTC](https://www.ruby-forum.com/t/segv-def-m-yield-end-m-lambda-v-p-v/112422 "2007-08-19T05:05:29Z")

</div>

e$B0J2\<$N$h$&$K$9$k$He(B SEGV e$B$K$J$j$^$9!#e(B % RUBY\_DEBUG=gc\_stress ./ruby -e ‘def m() yield \[\] end; m(&lambda {|\*v| p v})’ -e:1: – control frame ---------- c:0007 p:---- s:0016 b:0016 l:000015 d:000015 CFUNC :i…

---

## [Slave not removing slave\_proc\_\* files](https://www.ruby-forum.com/t/slave-not-removing-slave-proc-files/112353)

<div class="topic-metadata">

**Author:** [@Jos\_B](https://www.ruby-forum.com/u/Jos_B)\
**Replies:** 7\
**Last updated:** [August 19, 2007, 3:41am UTC](https://www.ruby-forum.com/t/slave-not-removing-slave-proc-files/112353 "2007-08-19T03:41:24Z")

</div>

Hi. In order to be able to run swiftiply\_mongrel\_rails under daemontools I patched swiftiply\_mongrel\_rails to use Ara’s Slave library. The patch does essentially this: slaves = \[\] 3.times do |i| require 'slave' …

---

## [Printing variable names](https://www.ruby-forum.com/t/printing-variable-names/112441)

<div class="topic-metadata">

**Author:** [@darren\_kirby](https://www.ruby-forum.com/u/darren_kirby)\
**Replies:** 3\
**Last updated:** [August 19, 2007, 1:37am UTC](https://www.ruby-forum.com/t/printing-variable-names/112441 "2007-08-19T01:37:17Z")

</div>

Hello all, I have an array of variables here: foo = \[s0, s1, s2, s3, s4, s5, s6, s7\] I need to loop over the array and print each variable’s name and value: s0: 23 s1: 56 s2: 345345 etc… I cannot seem to find a w…

---

## [Need help. want to use Net::sh to do sudo command](https://www.ruby-forum.com/t/need-help-want-to-use-net-sh-to-do-sudo-command/112398)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 1\
**Last updated:** [August 18, 2007, 10:41pm UTC](https://www.ruby-forum.com/t/need-help-want-to-use-net-sh-to-do-sudo-command/112398 "2007-08-18T22:41:05Z")

</div>

I want to do a sudo command to change permissions on our server because our admin has some kind of build that blows away the image directory and it ends up having the wrong permissions after the build. When the sudo …

---

## [How do you print the first 5 records in an array?](https://www.ruby-forum.com/t/how-do-you-print-the-first-5-records-in-an-array/112399)

<div class="topic-metadata">

**Author:** [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Replies:** 28\
**Last updated:** [August 18, 2007, 9:44pm UTC](https://www.ruby-forum.com/t/how-do-you-print-the-first-5-records-in-an-array/112399 "2007-08-18T21:44:57Z")

</div>

Let’s say I have an array defined as: @people = \[“Jim”, “Jen”, “Jess”, “Jay”, “Jack”, “John”, “Jeff”, “Jed”, “Jill”\] How would I then print out the first 5 records of that array? (i.e. from Jim to Jack) Any ideas?

---

## [Execute ruby commands in a program](https://www.ruby-forum.com/t/execute-ruby-commands-in-a-program/112420)

<div class="topic-metadata">

**Author:** [@h4z3](https://www.ruby-forum.com/u/h4z3)\
**Replies:** 6\
**Last updated:** [August 18, 2007, 8:59pm UTC](https://www.ruby-forum.com/t/execute-ruby-commands-in-a-program/112420 "2007-08-18T20:59:52Z")

</div>

Ok so lets say i have a program, And within the program i call a command such as Ruby: Is there anyway to be able to run live ruby code and print the answers (i dont really know how to put it) so like… Ruby: name = …

---

## [Using StandardAdditions.osax with appscript](https://www.ruby-forum.com/t/using-standardadditions-osax-with-appscript/112381)

<div class="topic-metadata">

**Author:** [@Morton\_G](https://www.ruby-forum.com/u/Morton_G)\
**Replies:** 4\
**Last updated:** [August 18, 2007, 7:53pm UTC](https://www.ruby-forum.com/t/using-standardadditions-osax-with-appscript/112381 "2007-08-18T19:53:45Z")

</div>

Can anybody tell me how to execute a command (e.g., beep) implemented in /System/Library/ScriptingAdditions/StandardAdditions.osax from a Ruby script using the appscript library? What I thought might work was #! /usr…

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

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