# Ruby

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

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

---

## [\[Bug #500\] TZ=HST$B$G(BFailure: test\_strftime(TestTime)](https://www.ruby-forum.com/t/bug-500-tz-hst-b-g-bfailure-test-strftime-testtime/146909)

<div class="topic-metadata">

**Author:** [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Replies:** 3\
**Last updated:** [August 28, 2008, 4:57pm UTC](https://www.ruby-forum.com/t/bug-500-tz-hst-b-g-bfailure-test-strftime-testtime/146909 "2008-08-28T16:57:40Z")

</div>

Bug #500: TZ=HSTe$B$Ge(BFailure: test\_strftime(TestTime) http://redmine.ruby-lang.org/issues/show/500 e$B5/I\<\<Te(B: Kazuhiro NISHIYAMA e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal http://zunda.freeshell.org/d/2008082…

---

## [How can I require other module?](https://www.ruby-forum.com/t/how-can-i-require-other-module/147115)

<div class="topic-metadata">

**Author:** [@youhaodeyi](https://www.ruby-forum.com/u/youhaodeyi)\
**Replies:** 3\
**Last updated:** [August 28, 2008, 4:28pm UTC](https://www.ruby-forum.com/t/how-can-i-require-other-module/147115 "2008-08-28T16:28:45Z")

</div>

My ruby script and module script are in the same directory. I print the $: variable and found the current directory “.” is in there. But I always get the error: no such file to load. What is the problem?

---

## [Problemm using ruby classes](https://www.ruby-forum.com/t/problemm-using-ruby-classes/147008)

<div class="topic-metadata">

**Author:** [@toospoiled](https://www.ruby-forum.com/u/toospoiled)\
**Replies:** 4\
**Last updated:** [August 28, 2008, 3:36pm UTC](https://www.ruby-forum.com/t/problemm-using-ruby-classes/147008 "2008-08-28T15:36:19Z")

</div>

I’m new on ruby so probably my question is stupid. I’ve created some ruby classes, but when I try to use them with the operator .new from another program file, it gives me this error: uninitializad constant SQLite\_Uti…

---

## [Re: How would this Perl script look in Ruby?](https://www.ruby-forum.com/t/re-how-would-this-perl-script-look-in-ruby/147110)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 0\
**Last updated:** [August 28, 2008, 2:42pm UTC](https://www.ruby-forum.com/t/re-how-would-this-perl-script-look-in-ruby/147110 "2008-08-28T14:42:42Z")

</div>

Can somebody please me tell the way to write this script in Ruby? Certainly. In one window, open a text editor. In another window open your Ruby documentation, for example http://www.ruby-doc.org/ or buy and o…

---

## [Sort an array based on an attribute of its objects](https://www.ruby-forum.com/t/sort-an-array-based-on-an-attribute-of-its-objects/147103)

<div class="topic-metadata">

**Author:** [@josh](https://www.ruby-forum.com/u/josh)\
**Replies:** 3\
**Last updated:** [August 28, 2008, 2:19pm UTC](https://www.ruby-forum.com/t/sort-an-array-based-on-an-attribute-of-its-objects/147103 "2008-08-28T14:19:14Z")

</div>

Hi all The title of this topic is not very good, but I didn’t really know how to describe it in just a few words… So here is what I need to do: I have a array of some objects: \[obj1, obj2, obj3, obj4\] All objects h…

---

## [Re: How to format decimals on the fly (for EOF blocks)?](https://www.ruby-forum.com/t/re-how-to-format-decimals-on-the-fly-for-eof-blocks/147105)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 0\
**Last updated:** [August 28, 2008, 2:16pm UTC](https://www.ruby-forum.com/t/re-how-to-format-decimals-on-the-fly-for-eof-blocks/147105 "2008-08-28T14:16:18Z")

</div>

I don’t understand how your figures relate to each other in the example you gave, but here are a few ways to format a float to one decimal place: val = 0.4423 printf “%6.1f mcg\\n”, val str = sprintf("%6.1f mcg", val…

---

## [Still Query Continues](https://www.ruby-forum.com/t/still-query-continues/146845)

<div class="topic-metadata">

**Author:** [@newb](https://www.ruby-forum.com/u/newb)\
**Replies:** 3\
**Last updated:** [August 28, 2008, 2:06pm UTC](https://www.ruby-forum.com/t/still-query-continues/146845 "2008-08-28T14:06:54Z")

</div>

Thanks for taking time for Reply. My Problem Has not Sorted Out.Actually i m Extracting These images from other Webpages. Using Hpricot i Got all the Image urls.I did code like below doc = Hpricot.parse(item.desc…

---

## [How to format decimals on the fly (for EOF blocks)?](https://www.ruby-forum.com/t/how-to-format-decimals-on-the-fly-for-eof-blocks/147098)

<div class="topic-metadata">

**Author:** [@caiwangqin](https://www.ruby-forum.com/u/caiwangqin)\
**Replies:** 1\
**Last updated:** [August 28, 2008, 2:04pm UTC](https://www.ruby-forum.com/t/how-to-format-decimals-on-the-fly-for-eof-blocks/147098 "2008-08-28T14:04:43Z")

</div>

Hello, I’m facing a problem where, for instance, 7mcg of Nutrient is required per day. It’s scaled in the db to 3 (or more) decimal places, but on the page, often there will show Nutrient 0 mcg 8% – otherwise … 0.44…

---

## [How to avoid passing by reference and how to copy objects](https://www.ruby-forum.com/t/how-to-avoid-passing-by-reference-and-how-to-copy-objects/146982)

<div class="topic-metadata">

**Author:** [@scudco](https://www.ruby-forum.com/u/scudco)\
**Replies:** 11\
**Last updated:** [August 28, 2008, 1:51pm UTC](https://www.ruby-forum.com/t/how-to-avoid-passing-by-reference-and-how-to-copy-objects/146982 "2008-08-28T13:51:37Z")

</div>

Hi after a bit of searching and reading im quite confused by this. I first learnt C so used to being able to pass by reference or by value. In Ruby its just by reference (so ive just found out after an hour of chasing…

---

## [Regular Expressions](https://www.ruby-forum.com/t/regular-expressions/146776)

<div class="topic-metadata">

**Author:** [@newb](https://www.ruby-forum.com/u/newb)\
**Replies:** 15\
**Last updated:** [August 28, 2008, 1:15pm UTC](https://www.ruby-forum.com/t/regular-expressions/146776 "2008-08-28T13:15:37Z")

</div>

I have a image url like this From this url i need to extract only the picture name using regular Expressions. That is I Want to Extract like this =\> Davis-Love-III.jpg. Any Advices

---

## [\[ANN\] Mysqlplus, a new thread aware MySQL driver for Ruby](https://www.ruby-forum.com/t/ann-mysqlplus-a-new-thread-aware-mysql-driver-for-ruby/147095)

<div class="topic-metadata">

**Author:** [@oldmoe](https://www.ruby-forum.com/u/oldmoe)\
**Replies:** 0\
**Last updated:** [August 28, 2008, 1:09pm UTC](https://www.ruby-forum.com/t/ann-mysqlplus-a-new-thread-aware-mysql-driver-for-ruby/147095 "2008-08-28T13:09:06Z")

</div>

I am pleased to announce the availability of a new MySQL driver. Mysqlplus. The driver builds on the original MySQL C extension but adds two important features 1 - Asynchronous command processing support 2 - Threaded…

---

## [Dont def need return](https://www.ruby-forum.com/t/dont-def-need-return/147086)

<div class="topic-metadata">

**Author:** [@sijo](https://www.ruby-forum.com/u/sijo)\
**Replies:** 4\
**Last updated:** [August 28, 2008, 11:55am UTC](https://www.ruby-forum.com/t/dont-def-need-return/147086 "2008-08-28T11:55:34Z")

</div>

Hi I was learing Ruby and have code like Class TestClass def getcolors arr=\[“Blue”,“Yellow”\] arr1=\[“1”,“2”\] end end obj=TestClass.new puts obj.getcolors And the result is 1 2 ..This looks some strange …

---

## [Encrypting password on form submit?](https://www.ruby-forum.com/t/encrypting-password-on-form-submit/147023)

<div class="topic-metadata">

**Author:** [@amanda](https://www.ruby-forum.com/u/amanda)\
**Replies:** 18\
**Last updated:** [August 28, 2008, 10:45am UTC](https://www.ruby-forum.com/t/encrypting-password-on-form-submit/147023 "2008-08-28T10:45:20Z")

</div>

Hi there, I’m trying to use a form to create a user for a site. All the information from the form is currently submitted to the database as is. I want the password to be encrypted in the database, but I have no idea h…

---

## [Re: Having a difficult time with Case statements](https://www.ruby-forum.com/t/re-having-a-difficult-time-with-case-statements/147076)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 0\
**Last updated:** [August 28, 2008, 10:17am UTC](https://www.ruby-forum.com/t/re-having-a-difficult-time-with-case-statements/147076 "2008-08-28T10:17:47Z")

</div>

http://www.ruby-forum.com/attachment/2623/startup.rb If you’re going to keep state in a local variable, then you need to keep looping within that method, because otherwise the value will be lost as soon as you retu…

---

## [Re: how to avoid passing by reference and how to copy objects](https://www.ruby-forum.com/t/re-how-to-avoid-passing-by-reference-and-how-to-copy-objects/147070)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 1\
**Last updated:** [August 28, 2008, 10:06am UTC](https://www.ruby-forum.com/t/re-how-to-avoid-passing-by-reference-and-how-to-copy-objects/147070 "2008-08-28T10:06:03Z")

</div>

Its basically like (probably IS under the hood) Pointers. so for some arrays a and b a = b thats basically copying the pointers themselves. So whatever changes i make in A will be reflected in B. Roughly. The Arra…

---

## [Moving all files in a folder to another hard drive](https://www.ruby-forum.com/t/moving-all-files-in-a-folder-to-another-hard-drive/146712)

<div class="topic-metadata">

**Author:** [@winterheat](https://www.ruby-forum.com/u/winterheat)\
**Replies:** 13\
**Last updated:** [August 28, 2008, 9:25am UTC](https://www.ruby-forum.com/t/moving-all-files-in-a-folder-to-another-hard-drive/146712 "2008-08-28T09:25:05Z")

</div>

I have some code below to move all files in a folder to another hard drive (which has 2TB of space). It runs well except that whenever a filename has some international characters, then the line if File.file?(basedir…

---

## [About mime/types](https://www.ruby-forum.com/t/about-mime-types/147067)

<div class="topic-metadata">

**Author:** [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Replies:** 0\
**Last updated:** [August 28, 2008, 9:08am UTC](https://www.ruby-forum.com/t/about-mime-types/147067 "2008-08-28T09:08:12Z")

</div>

Why does this MIME::Types\[‘text/plain’\] give ‘text/plaintext/plain’? The thing is I’m trying to understand how to use mime/types http://mime-types.rubyforge.org/classes/MIME/Types.html and I can’t mimic this example: …

---

## [Help with Custom ERB Templates](https://www.ruby-forum.com/t/help-with-custom-erb-templates/147063)

<div class="topic-metadata">

**Author:** [@snowbird122](https://www.ruby-forum.com/u/snowbird122)\
**Replies:** 1\
**Last updated:** [August 28, 2008, 7:28am UTC](https://www.ruby-forum.com/t/help-with-custom-erb-templates/147063 "2008-08-28T07:28:38Z")

</div>

I’m trying to create a custom erb template that allows me to mix MXML and Ruby. I’m having problems coming from the way I wish to implement it. In MXML you need tags which I would like to use Ruby to create. Take not…

---

## [Word boundaries for regular expressions](https://www.ruby-forum.com/t/word-boundaries-for-regular-expressions/146862)

<div class="topic-metadata">

**Author:** [@scudco](https://www.ruby-forum.com/u/scudco)\
**Replies:** 4\
**Last updated:** [August 28, 2008, 7:11am UTC](https://www.ruby-forum.com/t/word-boundaries-for-regular-expressions/146862 "2008-08-28T07:11:48Z")

</div>

Hi did a search for word boundaries but didnt quite find what i was looking for. If i have strings containing products and model numbers e.g. “JP-ATH Headphones JP” and I want to remove the last JP but not the one i…

---

## [Unit testing with class and floats](https://www.ruby-forum.com/t/unit-testing-with-class-and-floats/146989)

<div class="topic-metadata">

**Author:** [@scudco](https://www.ruby-forum.com/u/scudco)\
**Replies:** 3\
**Last updated:** [August 28, 2008, 7:07am UTC](https://www.ruby-forum.com/t/unit-testing-with-class-and-floats/146989 "2008-08-28T07:07:41Z")

</div>

Hi there im learning unit testing and have just recently started using classes (very basic no superclass etc) and now running into problems. I have a function which returns a class ojbect that contains float variable…

---

## [BigDecimal with Float comparision bug](https://www.ruby-forum.com/t/bigdecimal-with-float-comparision-bug/146879)

<div class="topic-metadata">

**Author:** [@lunatyq](https://www.ruby-forum.com/u/lunatyq)\
**Replies:** 9\
**Last updated:** [August 28, 2008, 5:29am UTC](https://www.ruby-forum.com/t/bigdecimal-with-float-comparision-bug/146879 "2008-08-28T05:29:16Z")

</div>

Hello, I have noticed that BigDecimal may fail in many cases when you try to compare it with float: Float: BigDecimal.new(“25.0”) == 25.0 =\> false Decimal: BigDecimal.new(“25.0”) == 25 =\> true (1…1000)…

---

## [HTML \<form\> and redirecting the result](https://www.ruby-forum.com/t/html-form-and-redirecting-the-result/147061)

<div class="topic-metadata">

**Author:** [@quik77](https://www.ruby-forum.com/u/quik77)\
**Replies:** 1\
**Last updated:** [August 28, 2008, 5:28am UTC](https://www.ruby-forum.com/t/html-form-and-redirecting-the-result/147061 "2008-08-28T05:28:41Z")

</div>

Hi there, since a long time I am using a very simple ruby script that translates input like ‘goo’ or ‘g’ or ‘google’ to the remote URL of google via a big case menu. It has maybe one thousand entries or more, keepin…

---

## [\[Feature #507\] cgi.rb$B$N(Btest$BDI2C(B](https://www.ruby-forum.com/t/feature-507-cgi-rb-b-n-btest-bdi2c-b/147002)

<div class="topic-metadata">

**Author:** [@Takeyuki\_F](https://www.ruby-forum.com/u/Takeyuki_F)\
**Replies:** 2\
**Last updated:** [August 28, 2008, 2:27am UTC](https://www.ruby-forum.com/t/feature-507-cgi-rb-b-n-btest-bdi2c-b/147002 "2008-08-28T02:27:57Z")

</div>

Feature #507: cgi.rbe$B$Ne(Bteste$BDI2Ce(B http://redmine.ruby-lang.org/issues/show/507 e$B5/I\<\<Te(B: Takeyuki F. e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal test/cgi/test\_cgi\_header.rb e$B$rE:IU$7$^$9!#e(BCGIAlte$…

---

## [Uninstalling Ruby 1.8.7 Help](https://www.ruby-forum.com/t/uninstalling-ruby-1-8-7-help/146865)

<div class="topic-metadata">

**Author:** [@dacbo](https://www.ruby-forum.com/u/dacbo)\
**Replies:** 5\
**Last updated:** [August 28, 2008, 1:08am UTC](https://www.ruby-forum.com/t/uninstalling-ruby-1-8-7-help/146865 "2008-08-28T01:08:44Z")

</div>

Hi Guys, I have run into a bind, and need to manually uninstall Ruby 1.8.7 from /usr/local, but I’m not sure exactly what to delete. Im running OS X Leopard and installed Ruby there so to not overwrite my system Ruby…

---

## [Syntax error, unexpected kELSE](https://www.ruby-forum.com/t/syntax-error-unexpected-kelse/147006)

<div class="topic-metadata">

**Author:** [@dacbo](https://www.ruby-forum.com/u/dacbo)\
**Replies:** 7\
**Last updated:** [August 27, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/syntax-error-unexpected-kelse/147006 "2008-08-27T19:56:06Z")

</div>

I’ve been trying to solve the problem in the following bit of code for quite some time now with no luck. The unexpected kELSE error is occuring in the commented line. $map is a multi-dimensional array and the makeshif…

---

## [Treetop question](https://www.ruby-forum.com/t/treetop-question/147032)

<div class="topic-metadata">

**Author:** [@lpc2148](https://www.ruby-forum.com/u/lpc2148)\
**Replies:** 0\
**Last updated:** [August 27, 2008, 7:49pm UTC](https://www.ruby-forum.com/t/treetop-question/147032 "2008-08-27T19:49:15Z")

</div>

Hi guys ! I started to learn to use treetop , so I would have a question : if I create a grammar this way : grammar Tester rule basic (\[a-f\] \[a-f\] \[a-f\] \[a-f\] \[a-f\]) { def val text\_value end } end end and use…

---

## [Looking for Examples](https://www.ruby-forum.com/t/looking-for-examples/146964)

<div class="topic-metadata">

**Author:** [@Glen\_Cooper](https://www.ruby-forum.com/u/Glen_Cooper)\
**Replies:** 7\
**Last updated:** [August 27, 2008, 6:25pm UTC](https://www.ruby-forum.com/t/looking-for-examples/146964 "2008-08-27T18:25:12Z")

</div>

I’m wondering if anyone can point me to some good example projects using IronRuby. Specifically I’m looking for libraries and projects using some of the things we take for granted with regular ruby development - rake…

---

## [Re: assert\_raise question](https://www.ruby-forum.com/t/re-assert-raise-question/147020)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 1\
**Last updated:** [August 27, 2008, 5:33pm UTC](https://www.ruby-forum.com/t/re-assert-raise-question/147020 "2008-08-27T17:33:14Z")

</div>

def test\_raise assert\_raise ArgumentError {raise ArgumentError.new(“basic argument issue”)} end Now there’s suddenly an Exception: undefined method ‘ArgumentError’… I was more than a little surprised to discover th…

---

## [Re: ActiveRecord Question -- making arrays or hashs out of database tables](https://www.ruby-forum.com/t/re-activerecord-question-making-arrays-or-hashs-out-of-database-tables/147019)

<div class="topic-metadata">

**Author:** [@glenn](https://www.ruby-forum.com/u/glenn)\
**Replies:** 0\
**Last updated:** [August 27, 2008, 4:53pm UTC](https://www.ruby-forum.com/t/re-activerecord-question-making-arrays-or-hashs-out-of-database-tables/147019 "2008-08-27T16:53:05Z")

</div>

Thanks for your reply.Â This is very helpful. Glenn ----- Original Message ---- From: Daniel B. removed\_email\_address@domain.invalid To: ruby-talk ML removed\_email\_address@domain.invalid Sent: Wednesday, August 20,…

---

## [Re: open3 and background processes](https://www.ruby-forum.com/t/re-open3-and-background-processes/146986)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 1\
**Last updated:** [August 27, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/re-open3-and-background-processes/146986 "2008-08-27T16:21:26Z")

</div>

I thought there was a way to peek ahead on an IO object to see if any data is available on the handle before attempting to read it You’re probably thinking of Kernel.select. To poll if data is available for read o…

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

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