# Ruby

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

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

---

## [Test::Unit - "exit" exception/command?](https://www.ruby-forum.com/t/test-unit-exit-exception-command/109503)

<div class="topic-metadata">

**Author:** [@mjacobs](https://www.ruby-forum.com/u/mjacobs)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 7:22pm UTC](https://www.ruby-forum.com/t/test-unit-exit-exception-command/109503 "2007-07-16T19:22:45Z")

</div>

I’m writing a suite of tests for an sms application. Because I want to properly test the functionality, it does try to send real messages, but with a dummy flag attached. This is fine, except the dummy flag is kept in…

---

## [How can I get the Ruby version from within a Ruby script?](https://www.ruby-forum.com/t/how-can-i-get-the-ruby-version-from-within-a-ruby-script/109540)

<div class="topic-metadata">

**Author:** [@paul](https://www.ruby-forum.com/u/paul)\
**Replies:** 7\
**Last updated:** [July 16, 2007, 7:21pm UTC](https://www.ruby-forum.com/t/how-can-i-get-the-ruby-version-from-within-a-ruby-script/109540 "2007-07-16T19:21:45Z")

</div>

I want to log the current Ruby version to a log file along with the script version, but I don’t know how to get the Ruby version from within a running script. I tried: puts system(“ruby -v”) but that only returns “t…

---

## [CentOS 5 - ruby-1.8.6 - openssl](https://www.ruby-forum.com/t/centos-5-ruby-1-8-6-openssl/109476)

<div class="topic-metadata">

**Author:** [@oldbug](https://www.ruby-forum.com/u/oldbug)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 7:09pm UTC](https://www.ruby-forum.com/t/centos-5-ruby-1-8-6-openssl/109476 "2007-07-16T19:09:44Z")

</div>

Hi list, Frist of all, I’m very sorry if I bother you all with another post on using openssl, but I’m really tearibng my hair off since a number of weeks… As the subject says, I’m runnint CentOS5, I’ve installed ruby…

---

## [Convert to time value](https://www.ruby-forum.com/t/convert-to-time-value/109542)

<div class="topic-metadata">

**Author:** [@qwerty73](https://www.ruby-forum.com/u/qwerty73)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 6:40pm UTC](https://www.ruby-forum.com/t/convert-to-time-value/109542 "2007-07-16T18:40:29Z")

</div>

Hi to all, i’ve a timestamp value stored in a Postgres DB. I’ve to make the difference between the time value obtained with Time.now function and the time value that get from the DB. The code is above: res = conn.que…

---

## [Accessing the name of the current function](https://www.ruby-forum.com/t/accessing-the-name-of-the-current-function/109541)

<div class="topic-metadata">

**Author:** [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 6:22pm UTC](https://www.ruby-forum.com/t/accessing-the-name-of-the-current-function/109541 "2007-07-16T18:22:40Z")

</div>

Is there away to access the name of the currently defined function? Example: Right now I do tracing like this: def myfunc(a,b) trace.debug “ENTER myfunc a=#{a} b=#{b}” … trace.debug “LEAVE myfunc result=#{result}” …

---

## [Strange Segfault](https://www.ruby-forum.com/t/strange-segfault/109368)

<div class="topic-metadata">

**Author:** [@Glen\_H](https://www.ruby-forum.com/u/Glen_H)\
**Replies:** 8\
**Last updated:** [July 16, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/strange-segfault/109368 "2007-07-16T18:08:39Z")

</div>

I have an interesting problem. I have a script that I wish to use to check a database and then map drives based on who is logging on and the info in the database. When I run the script on any of the machines in the…

---

## [Nested structures and C extensions](https://www.ruby-forum.com/t/nested-structures-and-c-extensions/109509)

<div class="topic-metadata">

**Author:** [@infamouxxx](https://www.ruby-forum.com/u/infamouxxx)\
**Replies:** 1\
**Last updated:** [July 16, 2007, 5:35pm UTC](https://www.ruby-forum.com/t/nested-structures-and-c-extensions/109509 "2007-07-16T17:35:35Z")

</div>

Hey everybody, I’ve been wrestling with an issue in writing a Ruby extension with C. I’m seeing that I can access (without Bus errors) top level attributes in my initial structure that aren’t nestled into another C st…

---

## [Awk regexp search](https://www.ruby-forum.com/t/awk-regexp-search/108271)

<div class="topic-metadata">

**Author:** [@baptiste\_AuguiSSSS](https://www.ruby-forum.com/u/baptiste_AuguiSSSS)\
**Replies:** 10\
**Last updated:** [July 16, 2007, 5:11pm UTC](https://www.ruby-forum.com/t/awk-regexp-search/108271 "2007-07-16T17:11:09Z")

</div>

Hi, The last bit of a bash program is still resisting me. Here is the code I used before: awk ‘/scattering efficiency/{print $4}’ …/OUTPUTFILES/Output.dat How would you do that in Ruby? I just need to locate this reg…

---

## [Parsing an apache access log line](https://www.ruby-forum.com/t/parsing-an-apache-access-log-line/109528)

<div class="topic-metadata">

**Author:** [@joenova](https://www.ruby-forum.com/u/joenova)\
**Replies:** 5\
**Last updated:** [July 16, 2007, 5:00pm UTC](https://www.ruby-forum.com/t/parsing-an-apache-access-log-line/109528 "2007-07-16T17:00:31Z")

</div>

a have a line to parse… 10.88.90.75 - - \[16/Jul/2007:07:46:09 -0400\] “GET /star/images/main.gif HTTP/1.1” 200 334 anyone has a better idea… got stuck coming up with one simple regex ( the double quote…) Need to token…

---

## [Rb\_load\_file crashes when there no bracket is provided](https://www.ruby-forum.com/t/rb-load-file-crashes-when-there-no-bracket-is-provided/109532)

<div class="topic-metadata">

**Author:** [@saravanan77](https://www.ruby-forum.com/u/saravanan77)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 4:59pm UTC](https://www.ruby-forum.com/t/rb-load-file-crashes-when-there-no-bracket-is-provided/109532 "2007-07-16T16:59:10Z")

</div>

Hi, When i tried to load the below mentioned code using rb\_load\_file it works def Category(pArg1) lvalue = (""" + “CatA” + “”" + pArg1) eval “#{lvalue}” end def is(pArg1) return “==”" + pArg1 + “”" end i = Cate…

---

## [Stamping my own timestamp](https://www.ruby-forum.com/t/stamping-my-own-timestamp/109530)

<div class="topic-metadata">

**Author:** [@bodikp](https://www.ruby-forum.com/u/bodikp)\
**Replies:** 4\
**Last updated:** [July 16, 2007, 4:05pm UTC](https://www.ruby-forum.com/t/stamping-my-own-timestamp/109530 "2007-07-16T16:05:20Z")

</div>

Is there a way to “touch” a file with a time stamp of my own choosing, in other words, not the “now” time? I’ve got a bunch of files that have been inadvertently “touched” time-wise, and I need them to have truer time…

---

## [Ruby file info and processing module](https://www.ruby-forum.com/t/ruby-file-info-and-processing-module/109520)

<div class="topic-metadata">

**Author:** [@vfcforums](https://www.ruby-forum.com/u/vfcforums)\
**Replies:** 1\
**Last updated:** [July 16, 2007, 12:14pm UTC](https://www.ruby-forum.com/t/ruby-file-info-and-processing-module/109520 "2007-07-16T12:14:44Z")

</div>

ruby file info and processing module Is there a ruby module that handles things like file, creation date, attributes, etc? I need something that can scan a directory for a filespec and return the attributes in an arr…

---

## [Tempfile : delete problem](https://www.ruby-forum.com/t/tempfile-delete-problem/109215)

<div class="topic-metadata">

**Author:** [@ronaldfischer](https://www.ruby-forum.com/u/ronaldfischer)\
**Replies:** 7\
**Last updated:** [July 16, 2007, 11:12am UTC](https://www.ruby-forum.com/t/tempfile-delete-problem/109215 "2007-07-16T11:12:25Z")

</div>

(Ruby 1.8.6 under Windows) My application creates a series of temporary files. I decided to use the tempfile module of Ruby, but I needed to control the file extension of the generated temporary file (should end in .x…

---

## [Blocking IO on windows in IRB](https://www.ruby-forum.com/t/blocking-io-on-windows-in-irb/109505)

<div class="topic-metadata">

**Author:** [@calande](https://www.ruby-forum.com/u/calande)\
**Replies:** 1\
**Last updated:** [July 16, 2007, 7:43am UTC](https://www.ruby-forum.com/t/blocking-io-on-windows-in-irb/109505 "2007-07-16T07:43:00Z")

</div>

Is there anyway around the blocking IO on windows? I’m trying to write an ruby app that is designed to be used from irb. It uses background threads to do some work, but they don’t appear to block at input on windows. …

---

## [Weirdness with ruby unit testing on mac](https://www.ruby-forum.com/t/weirdness-with-ruby-unit-testing-on-mac/109396)

<div class="topic-metadata">

**Author:** [@crucoba](https://www.ruby-forum.com/u/crucoba)\
**Replies:** 11\
**Last updated:** [July 16, 2007, 3:34am UTC](https://www.ruby-forum.com/t/weirdness-with-ruby-unit-testing-on-mac/109396 "2007-07-16T03:34:40Z")

</div>

I have a ruby project that I’ve written in a Linux environment. (Ruby 1.8.5, on Ubuntu.) I’d like to work on it on my Mac (Ruby 1.8.2, OSX 10.4) while I’m on vacation, and something weird is happening with my tests. …

---

## [Maximum Sub-Array (#131)](https://www.ruby-forum.com/t/maximum-sub-array-131/109472)

<div class="topic-metadata">

**Author:** [@Aureliano\_C](https://www.ruby-forum.com/u/Aureliano_C)\
**Replies:** 9\
**Last updated:** [July 16, 2007, 3:07am UTC](https://www.ruby-forum.com/t/maximum-sub-array-131/109472 "2007-07-16T03:07:39Z")

</div>

Given that the spoiler time is finished (I think) these are my solutions to the Quiz #131. I only worked on single arrays (and not matrixes). If found 3 different solutions. The first one just searches through the sol…

---

## [Creating Output Tables](https://www.ruby-forum.com/t/creating-output-tables/109499)

<div class="topic-metadata">

**Author:** [@Ari\_B](https://www.ruby-forum.com/u/Ari_B)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 2:16am UTC](https://www.ruby-forum.com/t/creating-output-tables/109499 "2007-07-16T02:16:36Z")

</div>

HAI, Is there a suggested library for creating nice tabley outputs? I was looking for output much in the way that benchmark has its output. asdf 12321 asdf asdf 12…

---

## [Religion (was: god 0.1.0 released)](https://www.ruby-forum.com/t/religion-was-god-0-1-0-released/109009)

<div class="topic-metadata">

**Author:** [@naething](https://www.ruby-forum.com/u/naething)\
**Replies:** 179\
**Last updated:** [July 16, 2007, 2:16am UTC](https://www.ruby-forum.com/t/religion-was-god-0-1-0-released/109009 "2007-07-16T02:16:26Z")

</div>

On 7/10/07, Todd B. removed\_email\_address@domain.invalid wrote: of the name, and then signing as “mostly agnostic”… You sir - have real feelings - less inappropriate. But, being a candidate for an old fuddy-duddy, I …

---

## [Rake?](https://www.ruby-forum.com/t/rake/108985)

<div class="topic-metadata">

**Author:** [@Ujjwal\_T](https://www.ruby-forum.com/u/Ujjwal_T)\
**Replies:** 3\
**Last updated:** [July 16, 2007, 1:15am UTC](https://www.ruby-forum.com/t/rake/108985 "2007-07-16T01:15:32Z")

</div>

Can a rake command create a Database (MySQL) from specifications in a .yml file??? I am newbie and I don’t understand how rake works ?? I am using windows… Plz Help!!! Regards, Ujjwal This e-mail communication an…

---

## [Fwd: Ruby quiz solution](https://www.ruby-forum.com/t/fwd-ruby-quiz-solution/109489)

<div class="topic-metadata">

**Author:** [@bbazzarrakk](https://www.ruby-forum.com/u/bbazzarrakk)\
**Replies:** 0\
**Last updated:** [July 15, 2007, 8:00pm UTC](https://www.ruby-forum.com/t/fwd-ruby-quiz-solution/109489 "2007-07-15T20:00:06Z")

</div>

Begin forwarded message: From: Florian G. removed\_email\_address@domain.invalid Date: July 13, 2007 7:35:13 PM CDT To: removed\_email\_address@domain.invalid Subject: Re: Ruby quiz solution

---

## [Fwd: please forward to ruby quiz submission](https://www.ruby-forum.com/t/fwd-please-forward-to-ruby-quiz-submission/192654)

<div class="topic-metadata">

**Author:** [@bbazzarrakk](https://www.ruby-forum.com/u/bbazzarrakk)\
**Replies:** 0\
**Last updated:** [July 15, 2007, 7:59pm UTC](https://www.ruby-forum.com/t/fwd-please-forward-to-ruby-quiz-submission/192654 "2007-07-15T19:59:05Z")

</div>

Begin forwarded message:

---

## [Re: Maximum Sub-Array (#131)](https://www.ruby-forum.com/t/re-maximum-sub-array-131/109426)

<div class="topic-metadata">

**Author:** [@anton](https://www.ruby-forum.com/u/anton)\
**Replies:** 5\
**Last updated:** [July 15, 2007, 7:08pm UTC](https://www.ruby-forum.com/t/re-maximum-sub-array-131/109426 "2007-07-15T19:08:01Z")

</div>

Hello, everybody! I am new here. I am also relatively new to ruby. I don’t know if it’s OK to ask questions here before the 48 hours period ends. So I am going to shoot straight and ask. I am trying to create a perfec…

---

## [How does Ruby gets bindings?](https://www.ruby-forum.com/t/how-does-ruby-gets-bindings/109486)

<div class="topic-metadata">

**Author:** [@laber](https://www.ruby-forum.com/u/laber)\
**Replies:** 0\
**Last updated:** [July 15, 2007, 6:56pm UTC](https://www.ruby-forum.com/t/how-does-ruby-gets-bindings/109486 "2007-07-15T18:56:00Z")

</div>

Hi everyone. Playing with modules, I come to the following: #------------------------------ module M def foo; end end module N def bar; end end class C; include M; end class D; include N; end module M define\_…

---

## [\[Quiz\] Maximum Sub-Array (#131)](https://www.ruby-forum.com/t/quiz-maximum-sub-array-131/109481)

<div class="topic-metadata">

**Author:** [@anton](https://www.ruby-forum.com/u/anton)\
**Replies:** 2\
**Last updated:** [July 15, 2007, 6:52pm UTC](https://www.ruby-forum.com/t/quiz-maximum-sub-array-131/109481 "2007-07-15T18:52:00Z")

</div>

Hornestly, it was the hardest quiz I have ever solved. Maybe because I am not so experienced as you are. I have two solutions. First one is straightforward. It walks an array and finds the max sub-array. I wrote it ju…

---

## [Xkcd and ugly code](https://www.ruby-forum.com/t/xkcd-and-ugly-code/109464)

<div class="topic-metadata">

**Author:** [@Sharon\_P](https://www.ruby-forum.com/u/Sharon_P)\
**Replies:** 4\
**Last updated:** [July 15, 2007, 6:47pm UTC](https://www.ruby-forum.com/t/xkcd-and-ugly-code/109464 "2007-07-15T18:47:00Z")

</div>

Hi, I read this xkcd strip the other day (xkcd: NP-Complete) and, of course, had to solve it. So I whipped up a quick bit of Ruby code that gave me the answers. Took about 5 minutes and then I was happy. Except I was…

---

## [Language transliteration help](https://www.ruby-forum.com/t/language-transliteration-help/109239)

<div class="topic-metadata">

**Author:** [@ktheory](https://www.ruby-forum.com/u/ktheory)\
**Replies:** 10\
**Last updated:** [July 15, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/language-transliteration-help/109239 "2007-07-15T18:08:56Z")

</div>

What is a good place to read about language transliteration? I have a piece of software that I want to provide language transliteration options… Is there something in Ruby to do this… (probnot). Just looking for a pus…

---

## [\[SOLUTION\] Maximum Sub-Array (#131)](https://www.ruby-forum.com/t/solution-maximum-sub-array-131/109482)

<div class="topic-metadata">

**Author:** [@Jesse\_Brown](https://www.ruby-forum.com/u/Jesse_Brown)\
**Replies:** 0\
**Last updated:** [July 15, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/solution-maximum-sub-array-131/109482 "2007-07-15T17:43:53Z")

</div>

Hi all. Attached are my solutions. Limitations and comments are listed in the code. Pretty basic, nothing fancy.

---

## [\[SOLUTION\] Maximum Sub-Array (#131)](https://www.ruby-forum.com/t/solution-maximum-sub-array-131/109483)

<div class="topic-metadata">

**Author:** [@willbailey](https://www.ruby-forum.com/u/willbailey)\
**Replies:** 0\
**Last updated:** [July 15, 2007, 5:41pm UTC](https://www.ruby-forum.com/t/solution-maximum-sub-array-131/109483 "2007-07-15T17:41:53Z")

</div>

Here is my solution. I extended Array to have a max\_slice method. It first checks if the array is all positives returning the array minus any zeros if so. Then it checks to see if the array is all negative or zero …

---

## [Rb\_big\_pow](https://www.ruby-forum.com/t/rb-big-pow/109480)

<div class="topic-metadata">

**Author:** [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Replies:** 1\
**Last updated:** [July 15, 2007, 5:13pm UTC](https://www.ruby-forum.com/t/rb-big-pow/109480 "2007-07-15T17:13:51Z")

</div>

e$B$U$He(B test\_integer.rb e$B$N\<B9T$re(B callgrind e$B$r$+$1$F!"e(Bbignum.c e$B$rD/$a$F$$$k$H!“e(Brb\_big\_pow e$B$NCf$K\<B9T$5$l$J$$ItJ,$,$”$k$N$Ke(B e$B5$$,$D$-$^$7$?!#$=$7$F$7$P$i$/D/$a$?7k2L!“e(Bn e$B$H$$$&JQ?t$O$:$…

---

## [Gets](https://www.ruby-forum.com/t/gets/109292)

<div class="topic-metadata">

**Author:** [@rorjeff](https://www.ruby-forum.com/u/rorjeff)\
**Replies:** 20\
**Last updated:** [July 15, 2007, 4:46pm UTC](https://www.ruby-forum.com/t/gets/109292 "2007-07-15T16:46:49Z")

</div>

Of course the code below will not work because gets is adding /n to the entry. I know that chomp will remove the /n but is there away to cut the /n without reassigning test1 to another variable IE test2 = test1.comp …

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

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