# Ruby

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

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

---

## [P()#=\>\[\]](https://www.ruby-forum.com/t/p/110113)

<div class="topic-metadata">

**Author:** [@eklerni](https://www.ruby-forum.com/u/eklerni)\
**Replies:** 6\
**Last updated:** [August 24, 2007, 4:54pm UTC](https://www.ruby-forum.com/t/p/110113 "2007-08-24T16:54:06Z")

</div>

e$B\>\>Hx$H$$$$$^$9!#e(B 1.9e$B$G%a%=%C%Ie(Bpe$B$NJV$jCM$,$=$N0z?t$NCM$K$J$j$^$7$?$,!"e(B rer = p p rer # =\> \[\] rer = p() p rer # =\> \[\] rer = p(()) # =\> nil p rer # =\> nil e$B0z?t$J$7$N;~e(B \[ \] e$B$rJV$9$N$O0U?^$7…

---

## [Aquarium v0.1.0 - An AOP Toolkit for Ruby](https://www.ruby-forum.com/t/aquarium-v0-1-0-an-aop-toolkit-for-ruby/112868)

<div class="topic-metadata">

**Author:** [@Dean\_W](https://www.ruby-forum.com/u/Dean_W)\
**Replies:** 2\
**Last updated:** [August 24, 2007, 4:24pm UTC](https://www.ruby-forum.com/t/aquarium-v0-1-0-an-aop-toolkit-for-ruby/112868 "2007-08-24T16:24:03Z")

</div>

I just released the first version of a new Aspect-Oriented Programming toolkit for Ruby called “Aquarium”, available at http://aquarium.rubyforge.org. I blogged about the goals of the project here: http://blog.aspect…

---

## [JRuby 1.0.1 Released](https://www.ruby-forum.com/t/jruby-1-0-1-released/112932)

<div class="topic-metadata">

**Author:** [@Thomas\_E](https://www.ruby-forum.com/u/Thomas_E)\
**Replies:** 0\
**Last updated:** [August 24, 2007, 4:23pm UTC](https://www.ruby-forum.com/t/jruby-1-0-1-released/112932 "2007-08-24T16:23:03Z")

</div>

The JRuby community is pleased to announce the release of JRuby 1.0.1. Homepage: http://www.jruby.org/ Download: http://dist.codehaus.org/jruby/ JRuby 1.0.1 is a minor release of our stable branch. The fixes for this …

---

## [Using rb-gsl with Windows](https://www.ruby-forum.com/t/using-rb-gsl-with-windows/112853)

<div class="topic-metadata">

**Author:** [@swabianeagle](https://www.ruby-forum.com/u/swabianeagle)\
**Replies:** 3\
**Last updated:** [August 24, 2007, 4:09pm UTC](https://www.ruby-forum.com/t/using-rb-gsl-with-windows/112853 "2007-08-24T16:09:04Z")

</div>

Hi, I’m trying to use rb-gsl under Windows, but I’m stuck. What I’ve done so far: downloaded gsl-1.9 and compiled it under cygwin downloaded rb-gsl-1.92 and ran ruby setup.rb all I had some problems with that. confi…

---

## [Fiber reviesed](https://www.ruby-forum.com/t/fiber-reviesed/112653)

<div class="topic-metadata">

**Author:** [@SASADA\_Koichi](https://www.ruby-forum.com/u/SASADA_Koichi)\
**Replies:** 14\
**Last updated:** [August 24, 2007, 3:42pm UTC](https://www.ruby-forum.com/t/fiber-reviesed/112653 "2007-08-24T15:42:58Z")

</div>

e$B!!$5$5$@$G$9!%e(B e$B!!$$$m$$$m$He(B Fiber e$B$N;EMM$rG:$s$G$$$?$s$G$9$,!$7h$a$^$7$?!%$G!$\<BAue(B e$B$7$F%3%\_%C%H$7$^$7$?!%e(B e$B!&e(BFiber e$B$O%;%\_%3%k!\<%A%se(B e$B!!e(BLua e$B$de(B Python e$B$G$\*$J$8$$N%;%%3…

---

## [Dynamic methods](https://www.ruby-forum.com/t/dynamic-methods/112884)

<div class="topic-metadata">

**Author:** [@S-jb](https://www.ruby-forum.com/u/S-jb)\
**Replies:** 4\
**Last updated:** [August 24, 2007, 1:37pm UTC](https://www.ruby-forum.com/t/dynamic-methods/112884 "2007-08-24T13:37:41Z")

</div>

I have seen examples of catching unkown methods called on a class with method\_missing. For example: class Example def initialize(…) #… end def method\_missing(item) call = item.id2name process(call) end end Bu…

---

## [Re: subarray using returns nil](https://www.ruby-forum.com/t/re-subarray-using-returns-nil/112902)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [August 24, 2007, 10:44am UTC](https://www.ruby-forum.com/t/re-subarray-using-returns-nil/112902 "2007-08-24T10:44:12Z")

</div>

Hi Todd The operation b = a\[1,-1\] is a slice operation where the first index is the start point and the second is the length of the array that you are retrieving - this is why you are getting nil for ‘b’ - the way to …

---

## [What is the difference between :, ::, .?](https://www.ruby-forum.com/t/what-is-the-difference-between/112812)

<div class="topic-metadata">

**Author:** [@mobileamusement](https://www.ruby-forum.com/u/mobileamusement)\
**Replies:** 6\
**Last updated:** [August 24, 2007, 10:29am UTC](https://www.ruby-forum.com/t/what-is-the-difference-between/112812 "2007-08-24T10:29:11Z")

</div>

Hi, I’m still confused when to use :: or : or . to access namespaces and methods. Could someone please tell me concisely when each should be used? Many thanks Gabriel

---

## [\# of lines in a file](https://www.ruby-forum.com/t/of-lines-in-a-file/112573)

<div class="topic-metadata">

**Author:** [@blufur](https://www.ruby-forum.com/u/blufur)\
**Replies:** 7\
**Last updated:** [August 24, 2007, 10:23am UTC](https://www.ruby-forum.com/t/of-lines-in-a-file/112573 "2007-08-24T10:23:11Z")

</div>

is there built-in method to determine the number of lines in a file? i tried file.readlines.length but it is very slow (dealing with files 1 million lines) thanks, DAN

---

## [Changing "self" for cleaner code](https://www.ruby-forum.com/t/changing-self-for-cleaner-code/112790)

<div class="topic-metadata">

**Author:** [@come](https://www.ruby-forum.com/u/come)\
**Replies:** 10\
**Last updated:** [August 24, 2007, 9:33am UTC](https://www.ruby-forum.com/t/changing-self-for-cleaner-code/112790 "2007-08-24T09:33:59Z")

</div>

Hi, Is it possible to change the value of self just to enter the context of an object, like for example in IRB ? For instance, is it possible to write something like : File.open(“file.txt”,“w”) do puts “Hello World” …

---

## [Strtod $B$N@:EY(B](https://www.ruby-forum.com/t/strtod-b-n-ey-b/112521)

<div class="topic-metadata">

**Author:** [@Satoshi\_N](https://www.ruby-forum.com/u/Satoshi_N)\
**Replies:** 26\
**Last updated:** [August 24, 2007, 8:07am UTC](https://www.ruby-forum.com/t/strtod-b-n-ey-b/112521 "2007-08-24T08:07:50Z")

</div>

e$BCf@n$H$$$$$^$9!#e(B http://www.rubyist.net/~matz/20070803.html#p04 e$B$G8@5Z$5$l$F$$$k!“e(Bstrtod e$B$N@:EY$N7o$K$D$$$FDs0F$,$”$j$^$9!#e(B 2007-08-02 e$B$N%3%a%s%H$Ge(B shiro e$B$5$s$,\>R2p$7$F$$$?!“e(B e$B!Ve(BHo…

---

## [How let (fire)watir run with the IE Browser Not Visible](https://www.ruby-forum.com/t/how-let-fire-watir-run-with-the-ie-browser-not-visible/112805)

<div class="topic-metadata">

**Author:** [@wanguan2000](https://www.ruby-forum.com/u/wanguan2000)\
**Replies:** 4\
**Last updated:** [August 24, 2007, 7:15am UTC](https://www.ruby-forum.com/t/how-let-fire-watir-run-with-the-ie-browser-not-visible/112805 "2007-08-24T07:15:43Z")

</div>

Rubies: which command can do this? Although I know (ruby \*.rb -d )can achieve this effect,but I want yo know in (fire)watir!

---

## [Ruby's (new) Bizarre Operator(s)](https://www.ruby-forum.com/t/rubys-new-bizarre-operator-s/112273)

<div class="topic-metadata">

**Author:** [@nobu](https://www.ruby-forum.com/u/nobu)\
**Replies:** 10\
**Last updated:** [August 24, 2007, 6:25am UTC](https://www.ruby-forum.com/t/rubys-new-bizarre-operator-s/112273 "2007-08-24T06:25:39Z")

</div>

e$B$J$+$@$G$9!#e(B http://www.rubyist.net/~matz/20070806.html#p01 ?.e$B$O$$$m$$$m$H$+$V$k$N$G!"e(B.?e$B$He(B.&e$B$K$7$F$\_$^$7$?!#e(B e$B$G$be(Bsafe navigatione$B$C$FMQ8l$,$$$^$$$A$o$+$j$K$/$$$+$b!#e(B Index: compile…

---

## [Subarray using \[1,-1\] returns nil](https://www.ruby-forum.com/t/subarray-using-1-1-returns-nil/112869)

<div class="topic-metadata">

**Author:** [@toadkicker](https://www.ruby-forum.com/u/toadkicker)\
**Replies:** 3\
**Last updated:** [August 24, 2007, 1:56am UTC](https://www.ruby-forum.com/t/subarray-using-1-1-returns-nil/112869 "2007-08-24T01:56:10Z")

</div>

a = %w(a b c d e f g) ; puts “a.length = #{a.length}” ; b = a\[1,-1\] ; puts “b.length = #{b.length}” ; Why is array b nil after the subarray? I expect it to be equal to “a” minus the first element. Todd

---

## [Get Date Modified value for a directory (folder)](https://www.ruby-forum.com/t/get-date-modified-value-for-a-directory-folder/112678)

<div class="topic-metadata">

**Author:** [@hiriumi](https://www.ruby-forum.com/u/hiriumi)\
**Replies:** 11\
**Last updated:** [August 24, 2007, 1:25am UTC](https://www.ruby-forum.com/t/get-date-modified-value-for-a-directory-folder/112678 "2007-08-24T01:25:19Z")

</div>

Hello, folks. I’m trying to find out a way to get “Date Modified” value for a directory on Windows. Is it possible to get the value from Ruby? The purpose of it is that I would like to get the newest sub directory in…

---

## [Dear Lazyweb: Gem Platforms](https://www.ruby-forum.com/t/dear-lazyweb-gem-platforms/112585)

<div class="topic-metadata">

**Author:** [@miracleofmagick](https://www.ruby-forum.com/u/miracleofmagick)\
**Replies:** 13\
**Last updated:** [August 24, 2007, 12:41am UTC](https://www.ruby-forum.com/t/dear-lazyweb-gem-platforms/112585 "2007-08-24T00:41:15Z")

</div>

As you may or may not have heard, RubyGems will be merged into Ruby 1.9 sometime in October. Before this can happen RubyGems needs to automatically install dependencies based on platforms. Fortunately I’ve got the a…

---

## [Once more unto the breach: private class methods](https://www.ruby-forum.com/t/once-more-unto-the-breach-private-class-methods/112854)

<div class="topic-metadata">

**Author:** [@Zeekar](https://www.ruby-forum.com/u/Zeekar)\
**Replies:** 7\
**Last updated:** [August 24, 2007, 12:21am UTC](https://www.ruby-forum.com/t/once-more-unto-the-breach-private-class-methods/112854 "2007-08-24T00:21:13Z")

</div>

Found a lot of discussion of this, but it didn’t seem to suggest a solution to a common pattern. The below completely useless example is modeled after a longer and more useful one in the Agile Web Development with Ra…

---

## [Probability distributions library in Ruby](https://www.ruby-forum.com/t/probability-distributions-library-in-ruby/91872)

<div class="topic-metadata">

**Author:** [@Libra](https://www.ruby-forum.com/u/Libra)\
**Replies:** 6\
**Last updated:** [August 23, 2007, 11:55pm UTC](https://www.ruby-forum.com/t/probability-distributions-library-in-ruby/91872 "2007-08-23T23:55:59Z")

</div>

Hello, I would extract some numbers according to a given probability distribution (at least, Normal, Exponential, Poisson and Bernoulli). Do you know if a similar library already exists in Ruby? I only found pseudo-…

---

## [Ruby into a .dll?](https://www.ruby-forum.com/t/ruby-into-a-dll/112816)

<div class="topic-metadata">

**Author:** [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Replies:** 4\
**Last updated:** [August 23, 2007, 11:30pm UTC](https://www.ruby-forum.com/t/ruby-into-a-dll/112816 "2007-08-23T23:30:00Z")

</div>

Hi, Is it possible to ‘compile’ ruby into a dll? Regards Aidy

---

## [I'm stuck with 'open-uri'](https://www.ruby-forum.com/t/im-stuck-with-open-uri/112846)

<div class="topic-metadata">

**Author:** [@val](https://www.ruby-forum.com/u/val)\
**Replies:** 0\
**Last updated:** [August 23, 2007, 8:49pm UTC](https://www.ruby-forum.com/t/im-stuck-with-open-uri/112846 "2007-08-23T20:49:19Z")

</div>

I’m trying ‘open-uri’ on Windows XP and my ‘test\_uri.rb’ runs OK. But when I transform ‘test\_uri.rb’ in ‘test\_uri.rhtml’ and run it on my localhost I get an error in the last line: /lib/ruby/1.8/net/http.rb:560:in \`in…

---

## [String.match on variable holding a regex?](https://www.ruby-forum.com/t/string-match-on-variable-holding-a-regex/112840)

<div class="topic-metadata">

**Author:** [@upenox](https://www.ruby-forum.com/u/upenox)\
**Replies:** 2\
**Last updated:** [August 23, 2007, 8:02pm UTC](https://www.ruby-forum.com/t/string-match-on-variable-holding-a-regex/112840 "2007-08-23T20:02:54Z")

</div>

Hi, I’m having a little problem with matching a regex against a string. I am storing data in mysql as a regex. At some point I need to match a string to this regex. Here is what I am working with: result = @dbconn.q…

---

## [Calling Ruby classes from .NET/C#](https://www.ruby-forum.com/t/calling-ruby-classes-from-net-c/112800)

<div class="topic-metadata">

**Author:** [@Vassilis\_R](https://www.ruby-forum.com/u/Vassilis_R)\
**Replies:** 1\
**Last updated:** [August 23, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/calling-ruby-classes-from-net-c/112800 "2007-08-23T19:30:46Z")

</div>

I have a small C# GUI and a rather extensive ruby application. What’s the best way to marry the two (I can’t change the C# GUI requirement and I really want to keep my Ruby app :slight\_smile: ). Ideally I would like t…

---

## [Calling JRuby from Ruby](https://www.ruby-forum.com/t/calling-jruby-from-ruby/112204)

<div class="topic-metadata">

**Author:** [@crenner](https://www.ruby-forum.com/u/crenner)\
**Replies:** 4\
**Last updated:** [August 23, 2007, 6:33pm UTC](https://www.ruby-forum.com/t/calling-jruby-from-ruby/112204 "2007-08-23T18:33:21Z")

</div>

Whats the best way of running a JRuby script from Ruby? I know you can do this : jruby script.rb, but that won’t allow passing of parameters from ruby to jruby. You could pass parameters by passing the Object.inspect …

---

## [Class method access instance variable?](https://www.ruby-forum.com/t/class-method-access-instance-variable/112774)

<div class="topic-metadata">

**Author:** [@upenox](https://www.ruby-forum.com/u/upenox)\
**Replies:** 10\
**Last updated:** [August 23, 2007, 5:29pm UTC](https://www.ruby-forum.com/t/class-method-access-instance-variable/112774 "2007-08-23T17:29:21Z")

</div>

Hi, I’m just learning ruby and I’m working on a server connection. I have the following code: class IRCBot … def connect puts “Connecting to #{@server}…” @conn = TCPSocket.new( @server, @port ) handle\_server\_regi…

---

## [Something like eregi() in ruby?](https://www.ruby-forum.com/t/something-like-eregi-in-ruby/112798)

<div class="topic-metadata">

**Author:** [@schu](https://www.ruby-forum.com/u/schu)\
**Replies:** 3\
**Last updated:** [August 23, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/something-like-eregi-in-ruby/112798 "2007-08-23T16:15:49Z")

</div>

hi people! i can’t info on that - is there anything comparable to the functionality of ereg() or preg\_match() of PHP under ruby? thx in advance S

---

## [Process Rings (#135)](https://www.ruby-forum.com/t/process-rings-135/112818)

<div class="topic-metadata">

**Author:** [@bbazzarrakk](https://www.ruby-forum.com/u/bbazzarrakk)\
**Replies:** 0\
**Last updated:** [August 23, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/process-rings-135/112818 "2007-08-23T16:13:47Z")

</div>

I can’t speak for the other solvers of course, but this kind of system programming is always complex for me. I had to fiddle with my own solutions for quite some time to get everything working as expected. In my for…

---

## [Wxruby and trayicon error and where to learn more about wxru](https://www.ruby-forum.com/t/wxruby-and-trayicon-error-and-where-to-learn-more-about-wxru/112797)

<div class="topic-metadata">

**Author:** [@kazaam](https://www.ruby-forum.com/u/kazaam)\
**Replies:** 2\
**Last updated:** [August 23, 2007, 4:06pm UTC](https://www.ruby-forum.com/t/wxruby-and-trayicon-error-and-where-to-learn-more-about-wxru/112797 "2007-08-23T16:06:45Z")

</div>

Hi, I’m working with wxruby since 2 days but next to this Wiki: http://wxruby.rubyforge.org/wiki/wiki.pl and this Doc: http://wxruby.rubyforge.org/doc/ I couldn’t find something usefull for it. Also del.icio.us has n…

---

## [MD5 authentication against Active Directory with ruby ldap](https://www.ruby-forum.com/t/md5-authentication-against-active-directory-with-ruby-ldap/112692)

<div class="topic-metadata">

**Author:** [@jamesyoung](https://www.ruby-forum.com/u/jamesyoung)\
**Replies:** 7\
**Last updated:** [August 23, 2007, 3:56pm UTC](https://www.ruby-forum.com/t/md5-authentication-against-active-directory-with-ruby-ldap/112692 "2007-08-23T15:56:44Z")

</div>

Here is the code: require ‘ldap’ require ‘base64’ require ‘digest/md5’ pass = “{MD5}” + Base64.encode64(Digest::MD5.digest(“secret”) ).chomp pass=‘secret’ conn = LDAP::Conn.new( ‘dc.domain.com’, 389 ) conn.set\_op…

---

## [Hash#keys, Hash#values order question](https://www.ruby-forum.com/t/hash-keys-hash-values-order-question/112796)

<div class="topic-metadata">

**Author:** [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Replies:** 2\
**Last updated:** [August 23, 2007, 3:22pm UTC](https://www.ruby-forum.com/t/hash-keys-hash-values-order-question/112796 "2007-08-23T15:22:38Z")

</div>

Let h be a Hash. Calculating the arrays k=h.keys v=h.values under the assumption that h is not modified in between, is it guaranteed that for all indices n h\[k\[n\]\]==v\[n\] i.e. that Hash#values delivers the values …

---

## [Renaming Files](https://www.ruby-forum.com/t/renaming-files/112806)

<div class="topic-metadata">

**Author:** [@mobileamusement](https://www.ruby-forum.com/u/mobileamusement)\
**Replies:** 6\
**Last updated:** [August 23, 2007, 2:34pm UTC](https://www.ruby-forum.com/t/renaming-files/112806 "2007-08-23T14:34:32Z")

</div>

Hi, I’m just trying to rename a whole load of files in a directory. Been palying with IRB. My code doesn’t work, no doubt because I fluffed it. irb(main):041:0\> Dir.entries(’.’).each do |f| irb(main):042:1\* next if f…

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

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