# Ruby

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

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

---

## [Alternative to Array#index?](https://www.ruby-forum.com/t/alternative-to-array-index/107765)

<div class="topic-metadata">

**Author:** [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Replies:** 1\
**Last updated:** [June 26, 2007, 9:17am UTC](https://www.ruby-forum.com/t/alternative-to-array-index/107765 "2007-06-26T09:17:47Z")

</div>

is there an alternative to Array#index? Faster version maybe?

---

## [Ruby doesn't know how to multiply](https://www.ruby-forum.com/t/ruby-doesnt-know-how-to-multiply/107440)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 43\
**Last updated:** [June 26, 2007, 9:12am UTC](https://www.ruby-forum.com/t/ruby-doesnt-know-how-to-multiply/107440 "2007-06-26T09:12:47Z")

</div>

Hello, Dear friends, today I have stumbled into a really weird problem. Try typing this on irb: 14.95 \* 0.6 == 8.97 Ruby says it’s false! I don’t know if this is a bug. Please let me know. By the way i´m on ruby 1.…

---

## [Ri broken?](https://www.ruby-forum.com/t/ri-broken/95277)

<div class="topic-metadata">

**Author:** [@wksmall](https://www.ruby-forum.com/u/wksmall)\
**Replies:** 14\
**Last updated:** [June 26, 2007, 7:22am UTC](https://www.ruby-forum.com/t/ri-broken/95277 "2007-06-26T07:22:30Z")

</div>

I haven’t been able to get ri or fxri to work right since I installed ruby 1.8.4 on my winxp laptop: ri Enumerable.zip More than one method matched your request. You can refine your search by asking for information…

---

## [Problem in bignorm](https://www.ruby-forum.com/t/problem-in-bignorm/97870)

<div class="topic-metadata">

**Author:** [@U.Nakamura](https://www.ruby-forum.com/u/U.Nakamura)\
**Replies:** 13\
**Last updated:** [June 26, 2007, 6:28am UTC](https://www.ruby-forum.com/t/problem-in-bignorm/97870 "2007-06-26T06:28:20Z")

</div>

e$B$3$s$K$A$O!"$J$+$\`$ie(B(e$B$&e(B)e$B$G$9!#e(B bignum.ce$B$Ne(Bbignorm()e$B$NCf$G!"e(B if (len\*SIZEOF\_BDIGITS \<= sizeof(VALUE)) { e$B$H$7$F$$$kH=DjJ8$,$"$j$^$9$,!"$3$3$GK\\Ev$K8+$J$$$H$$$1$J$$$Ne(B e$B$O!"!Ve(BlenSI…

---

## [Status of getresuid? Dropping privilege temporarily](https://www.ruby-forum.com/t/status-of-getresuid-dropping-privilege-temporarily/107782)

<div class="topic-metadata">

**Author:** [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Replies:** 0\
**Last updated:** [June 26, 2007, 5:55am UTC](https://www.ruby-forum.com/t/status-of-getresuid-dropping-privilege-temporarily/107782 "2007-06-26T05:55:15Z")

</div>

I wanted to reliably temporarily or permanently drop privileges from Ruby so I tried porting the code in … http://www.cs.berkeley.edu/~daw/papers/setuid-usenix02.pdf But rapidly found that… a) They strongly recommend…

---

## [Dynamically define attr\_accessors on objects?](https://www.ruby-forum.com/t/dynamically-define-attr-accessors-on-objects/107720)

<div class="topic-metadata">

**Author:** [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Replies:** 4\
**Last updated:** [June 26, 2007, 5:32am UTC](https://www.ruby-forum.com/t/dynamically-define-attr-accessors-on-objects/107720 "2007-06-26T05:32:04Z")

</div>

How can I dynamically define attr\_accessors on an object? EX:;: class Person attr\_accessor :firstname end p = Person.new p.firstname = ‘aaron’ p.instance\_variable\_set(:@lastname, ‘smith’) puts p.inspect puts p.f…

---

## [Conditional jump or move depends on uninitialised value(s) i](https://www.ruby-forum.com/t/conditional-jump-or-move-depends-on-uninitialised-value-s-i/107681)

<div class="topic-metadata">

**Author:** [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Replies:** 3\
**Last updated:** [June 26, 2007, 4:43am UTC](https://www.ruby-forum.com/t/conditional-jump-or-move-depends-on-uninitialised-value-s-i/107681 "2007-06-26T04:43:11Z")

</div>

valgrind e$B$r$+$1$?$H$3$m$H$j$"$($::G=i$N$,e(B ==32482== Conditional jump or move depends on uninitialised value(s) ==32482== at 0x80E1880: th\_make\_env\_each (vm.c:255) ==32482== by 0x80E1DDF: th\_make\_env\_object…

---

## [A log of talk by Dave Thomas in RubyKaigi2007](https://www.ruby-forum.com/t/a-log-of-talk-by-dave-thomas-in-rubykaigi2007/107769)

<div class="topic-metadata">

**Author:** [@zunda](https://www.ruby-forum.com/u/zunda)\
**Replies:** 2\
**Last updated:** [June 26, 2007, 4:28am UTC](https://www.ruby-forum.com/t/a-log-of-talk-by-dave-thomas-in-rubykaigi2007/107769 "2007-06-26T04:28:11Z")

</div>

Hello, This is to announce publication of a reconstruction of the talk \`The Island of Ruby’ by Dave T. in RubyKagigi2007 http://jp.rubyist.net/RubyKaigi2007/ I thought the talk is very important with suggestion of th…

---

## [One week left for June Ruby Project Spotlight submissions](https://www.ruby-forum.com/t/one-week-left-for-june-ruby-project-spotlight-submissions/107779)

<div class="topic-metadata">

**Author:** [@naething](https://www.ruby-forum.com/u/naething)\
**Replies:** 0\
**Last updated:** [June 26, 2007, 4:24am UTC](https://www.ruby-forum.com/t/one-week-left-for-june-ruby-project-spotlight-submissions/107779 "2007-06-26T04:24:10Z")

</div>

I announced a while ago that I’ll be running a series on the O’Reilly blog called “Ruby Project Spotlight” which will feature one cool up-and-coming or fast moving Ruby project a month. The details are in the origina…

---

## [Looking for a match](https://www.ruby-forum.com/t/looking-for-a-match/107761)

<div class="topic-metadata">

**Author:** [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Replies:** 2\
**Last updated:** [June 26, 2007, 3:03am UTC](https://www.ruby-forum.com/t/looking-for-a-match/107761 "2007-06-26T03:03:07Z")

</div>

Hey, I’m looking to match a string to another string ANYWHERE in a new file. For instance, my code looks like such: if readlines\[\*\] == chosen\_one # If there's a match - next …

---

## [Gems gone missing?](https://www.ruby-forum.com/t/gems-gone-missing/107704)

<div class="topic-metadata">

**Author:** [@Sharon\_P](https://www.ruby-forum.com/u/Sharon_P)\
**Replies:** 9\
**Last updated:** [June 26, 2007, 2:17am UTC](https://www.ruby-forum.com/t/gems-gone-missing/107704 "2007-06-26T02:17:04Z")

</div>

Hi, I’ve just spent the evening installing gruff (all the way from step 1: install X11…), but now any ruby code I have that uses a gem can’t seem to find it. For example, irb(main):001:0\> require ‘net-ssh’ LoadErro…

---

## [Private Method Error](https://www.ruby-forum.com/t/private-method-error/107767)

<div class="topic-metadata">

**Author:** [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Replies:** 2\
**Last updated:** [June 26, 2007, 2:06am UTC](https://www.ruby-forum.com/t/private-method-error/107767 "2007-06-26T02:06:04Z")

</div>

Once again, more questions. So this is pertaining to my implementation of the name picker app. When I pick a random name, I then proceed to check if it matches any name in the used\_names file. However, I keep getting …

---

## [REXML XPath question](https://www.ruby-forum.com/t/rexml-xpath-question/107750)

<div class="topic-metadata">

**Author:** [@del](https://www.ruby-forum.com/u/del)\
**Replies:** 2\
**Last updated:** [June 26, 2007, 12:18am UTC](https://www.ruby-forum.com/t/rexml-xpath-question/107750 "2007-06-26T00:18:11Z")

</div>

Can anyone explain these result to me (see bottom)? require ‘rexml//document’ d = REXML::Document.new %{ test 3 4 5 6 } REXML::XPath.match d, “/html/body/p\[@i…

---

## [Lone Star Rubyconf 2007 - Speakers, Hotel and Training](https://www.ruby-forum.com/t/lone-star-rubyconf-2007-speakers-hotel-and-training/107254)

<div class="topic-metadata">

**Author:** [@sauy7](https://www.ruby-forum.com/u/sauy7)\
**Replies:** 1\
**Last updated:** [June 25, 2007, 11:36pm UTC](https://www.ruby-forum.com/t/lone-star-rubyconf-2007-speakers-hotel-and-training/107254 "2007-06-25T23:36:49Z")

</div>

Howdy All Lone Star Rubyconf 2007 has been making great progress and we have now published the information you have been asking for. The conference hotel is AmeriSuites, with a rate of $85 per night, plus tax. Amer…

---

## [YAML::Syck line numbers?](https://www.ruby-forum.com/t/yaml-syck-line-numbers/107753)

<div class="topic-metadata">

**Author:** [@dankitania](https://www.ruby-forum.com/u/dankitania)\
**Replies:** 0\
**Last updated:** [June 25, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/yaml-syck-line-numbers/107753 "2007-06-25T23:30:49Z")

</div>

I’ve dug through the YAML::Syck library source and the Ruby library, but was unable to find what I’m looking for… If the syck parser finds a syntax error, it reports the line number of the error. Is there a way …

---

## [.include?/.within? and English-thinking brains](https://www.ruby-forum.com/t/include-within-and-english-thinking-brains/107748)

<div class="topic-metadata">

**Author:** [@bluetrust](https://www.ruby-forum.com/u/bluetrust)\
**Replies:** 1\
**Last updated:** [June 25, 2007, 11:18pm UTC](https://www.ruby-forum.com/t/include-within-and-english-thinking-brains/107748 "2007-06-25T23:18:47Z")

</div>

In English, it’s clearer to ask, “Is Maggie one of the guests?” – rather than the awkward, “Does the guests include Maggie?” So why in Ruby, do we write, “list.include? scalar” – when we often mean, “scalar.within? li…

---

## [Basic millisecond code profile?](https://www.ruby-forum.com/t/basic-millisecond-code-profile/107744)

<div class="topic-metadata">

**Author:** [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Replies:** 1\
**Last updated:** [June 25, 2007, 10:20pm UTC](https://www.ruby-forum.com/t/basic-millisecond-code-profile/107744 "2007-06-25T22:20:54Z")

</div>

if I need to see the amount of milliseconds / seconds a method takes can I do something like this: class Person attr\_accessor :first def pl now = Time.now.usec #get milliseconds 0.upto(10000) do |i| i = ‘g’ end …

---

## [Addslashes()](https://www.ruby-forum.com/t/addslashes/107718)

<div class="topic-metadata">

**Author:** [@no137b](https://www.ruby-forum.com/u/no137b)\
**Replies:** 2\
**Last updated:** [June 25, 2007, 9:19pm UTC](https://www.ruby-forum.com/t/addslashes/107718 "2007-06-25T21:19:32Z")

</div>

\-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Is there a built-in function in Ruby similar to PHP’s addslashes() function? MySQL keeps breaking… -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8D…

---

## [eval\_jump.h$B!"(Beval\_method.h$B$N(Brdoc$B$,=hM}$5$l$J$](https://www.ruby-forum.com/t/eval-jump-h-b-beval-method-h-b-n-brdoc-b-hm-5-l-j/106713)

<div class="topic-metadata">

**Author:** [@akira\_yamada\_S\_SSB](https://www.ruby-forum.com/u/akira_yamada_S_SSB)\
**Replies:** 3\
**Last updated:** [June 25, 2007, 9:15pm UTC](https://www.ruby-forum.com/t/eval-jump-h-b-beval-method-h-b-n-brdoc-b-hm-5-l-j/106713 "2007-06-25T21:15:31Z")

</div>

Ruby 1.9e$B$Ge(Beval\_jump.he$B$He(Beval\_method.he$B$K$"$ke(B RDoce$B$,e(Bmake rdoce$B$G=hM}$5$l$J$$$^$^$K$J$k$h$&$G$9!#e(B e$B$H$j$"$($:$NBP=h$H$7$F$Oe(B .docmente$B$Ke(B\*.he$B$r2C$(!"e(B common.mke$B$Ne(Brdoce$B$N%\*…

---

## [Could anyone help me in the question, thanks?](https://www.ruby-forum.com/t/could-anyone-help-me-in-the-question-thanks/107725)

<div class="topic-metadata">

**Author:** [@rubyer](https://www.ruby-forum.com/u/rubyer)\
**Replies:** 3\
**Last updated:** [June 25, 2007, 8:55pm UTC](https://www.ruby-forum.com/t/could-anyone-help-me-in-the-question-thanks/107725 "2007-06-25T20:55:28Z")

</div>

In network application, we need to fill some fields of protocol header like below (in C): struct hdr { unsinged short ver; unsinged char len; unsinged char flg; … }; int main(void) { struct hdr hh; hh.ver = …

---

## [Helper to create multi-dimensional arrays](https://www.ruby-forum.com/t/helper-to-create-multi-dimensional-arrays/107654)

<div class="topic-metadata">

**Author:** [@inertia](https://www.ruby-forum.com/u/inertia)\
**Replies:** 20\
**Last updated:** [June 25, 2007, 8:50pm UTC](https://www.ruby-forum.com/t/helper-to-create-multi-dimensional-arrays/107654 "2007-06-25T20:50:26Z")

</div>

I came up with this method really quick to create x\*y arrays in Ruby. It mimicks Array#new’s behavior pretty closely wrt blocks, I hope. What do you all think? class \<\< Array def multi(x,y,\*args, &block) if args.le…

---

## [Linux/ia64$B$G(B'ucontext\_t' undeclared](https://www.ruby-forum.com/t/linux-ia64-b-g-bucontext-t-undeclared/106712)

<div class="topic-metadata">

**Author:** [@akira\_yamada\_S\_SSB](https://www.ruby-forum.com/u/akira_yamada_S_SSB)\
**Replies:** 15\
**Last updated:** [June 25, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/linux-ia64-b-g-bucontext-t-undeclared/106712 "2007-06-25T20:45:25Z")

</div>

e$B:G6a$Ne(BRuby 1.9e$B$re(BLinux/ia64e$B\>e$Ge(Bmakee$B$7$h$&$H$9$k$He(B e$B0J2\<$N$h$&$J%(%i!\<$K$J$j$^$9!#e(B gc.c: In function ‘garbage\_collect’: gc.c:1388: error: ‘ucontext\_t’ undeclared (first use in this function…

---

## [Behaviour of Enumerables reject vs. select mixed into Hash](https://www.ruby-forum.com/t/behaviour-of-enumerables-reject-vs-select-mixed-into-hash/107360)

<div class="topic-metadata">

**Author:** [@alexp](https://www.ruby-forum.com/u/alexp)\
**Replies:** 52\
**Last updated:** [June 25, 2007, 8:12pm UTC](https://www.ruby-forum.com/t/behaviour-of-enumerables-reject-vs-select-mixed-into-hash/107360 "2007-06-25T20:12:18Z")

</div>

Hello everybody, Could you please take a look at the result of the following statements: irb(main):001:0\> a = {‘foo’ =\> ‘bar’, ‘baz’ =\> ‘qux’} =\> {“baz”=\>“qux”, “foo”=\>“bar”} irb(main):002:0\> a.reject{|k,v| k==‘foo’ …

---

## [Q: how to start a module name with a lower case character?](https://www.ruby-forum.com/t/q-how-to-start-a-module-name-with-a-lower-case-character/107710)

<div class="topic-metadata">

**Author:** [@marksbrain](https://www.ruby-forum.com/u/marksbrain)\
**Replies:** 4\
**Last updated:** [June 25, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/q-how-to-start-a-module-name-with-a-lower-case-character/107710 "2007-06-25T20:08:18Z")

</div>

I am trying to write Ruby classes to model RDF, RDFS, and Owl, much like SWCLOS does for Common Lisp: module Rdfs … end x = Rdfs::Class.new(Rdfs::Label =\> “label\_1”) It would be nice to have a hack that would allow…

---

## [New gem for instantiating nested objects](https://www.ruby-forum.com/t/new-gem-for-instantiating-nested-objects/107659)

<div class="topic-metadata">

**Author:** [@Craig\_Muth](https://www.ruby-forum.com/u/Craig_Muth)\
**Replies:** 2\
**Last updated:** [June 25, 2007, 7:53pm UTC](https://www.ruby-forum.com/t/new-gem-for-instantiating-nested-objects/107659 "2007-06-25T19:53:15Z")

</div>

Chris C. and I threw together a simple gem to help create nested hierarchies (without relying on constructors). Sample usage: require ‘lay’ car = Car.lay( :color =\> “Red”, :driver =\> Driver.lay( :name =\> “Bob” ) ) I…

---

## [Using closures as a replacement for "class", @, and @@](https://www.ruby-forum.com/t/using-closures-as-a-replacement-for-class-and/107723)

<div class="topic-metadata">

**Author:** [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Replies:** 0\
**Last updated:** [June 25, 2007, 6:36pm UTC](https://www.ruby-forum.com/t/using-closures-as-a-replacement-for-class-and/107723 "2007-06-25T18:36:10Z")

</div>

Some of you might find it interesting that ruby’s closures/blocks can be used as an alternative for defining classes/objects. It’s actually quite simple. You just do this: instead of class/def initialize, you use a…

---

## [Drawr 1.0.1 Released](https://www.ruby-forum.com/t/drawr-1-0-1-released/107679)

<div class="topic-metadata">

**Author:** [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Replies:** 2\
**Last updated:** [June 25, 2007, 6:29pm UTC](https://www.ruby-forum.com/t/drawr-1-0-1-released/107679 "2007-06-25T18:29:09Z")

</div>

drawr version 1.0.1 has been released! http://seattlerb.org/ DESCRIPTION: This is a ruby wrapper around Plotr with a similar API to Gruff. You can create graphs with a similar interface to Gruff, but offload the …

---

## [RoR developer needed urgently](https://www.ruby-forum.com/t/ror-developer-needed-urgently/107716)

<div class="topic-metadata">

**Author:** [@nina](https://www.ruby-forum.com/u/nina)\
**Replies:** 1\
**Last updated:** [June 25, 2007, 6:16pm UTC](https://www.ruby-forum.com/t/ror-developer-needed-urgently/107716 "2007-06-25T18:16:02Z")

</div>

Startup company with limited budget and massive potential looking for occasional work for Ruby on Rails developer. Chance to really develop your skills with friendly, supportive people. Helpful if developer is based i…

---

## [Alias and subclasses](https://www.ruby-forum.com/t/alias-and-subclasses/107670)

<div class="topic-metadata">

**Author:** [@ratcheer](https://www.ruby-forum.com/u/ratcheer)\
**Replies:** 3\
**Last updated:** [June 25, 2007, 6:02pm UTC](https://www.ruby-forum.com/t/alias-and-subclasses/107670 "2007-06-25T18:02:59Z")

</div>

Hi everyone, The quick version: Is there a Ruby-ian way to get the alias method to propagate through subclasses? The longer one: I’ve got two classes with some simple inheritance: class Ticket def unreserve … en…

---

## [Syntax error with array interpolation](https://www.ruby-forum.com/t/syntax-error-with-array-interpolation/107709)

<div class="topic-metadata">

**Author:** [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Replies:** 2\
**Last updated:** [June 25, 2007, 5:04pm UTC](https://www.ruby-forum.com/t/syntax-error-with-array-interpolation/107709 "2007-06-25T17:04:05Z")

</div>

Below is a code snippet which gives me some headache: def headache yield(\*(foo(1)),“bar”) end def foo(n) \[n,n+2,n+5\] end headache { |a,b,c,d| puts a.to\_s; puts b.to\_s; puts c.to\_s; puts d } I had expected that th…

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

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