# Ruby

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

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

---

## [What is Ruby equivalent of Python's ' if \_\_name\_\_ == "\_\_main\_\_" '](https://www.ruby-forum.com/t/what-is-ruby-equivalent-of-pythons-if-name-main/151539)

<div class="topic-metadata">

**Author:** [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Replies:** 2\
**Last updated:** [October 22, 2008, 5:46pm UTC](https://www.ruby-forum.com/t/what-is-ruby-equivalent-of-pythons-if-name-main/151539 "2008-10-22T17:46:36Z")

</div>

In Python, I can use the test indicated in the subject line to determine if a file is being executed directly, as opposed to being loaded indirectly as the result of the execution of another file. I haven’t been able …

---

## [Rake "sh" does not echo command](https://www.ruby-forum.com/t/rake-sh-does-not-echo-command/151535)

<div class="topic-metadata">

**Author:** [@rake\_newb](https://www.ruby-forum.com/u/rake_newb)\
**Replies:** 2\
**Last updated:** [October 22, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/rake-sh-does-not-echo-command/151535 "2008-10-22T17:24:42Z")

</div>

From what I have read, I would expect the ruby/rake “sh” command to echo the system call to STDOUT - instead just executing it. Is there some reason why ruby/rake would not be echoing my system commands to my command …

---

## [Help with regular expression](https://www.ruby-forum.com/t/help-with-regular-expression/151471)

<div class="topic-metadata">

**Author:** [@rubina](https://www.ruby-forum.com/u/rubina)\
**Replies:** 7\
**Last updated:** [October 22, 2008, 5:04pm UTC](https://www.ruby-forum.com/t/help-with-regular-expression/151471 "2008-10-22T17:04:15Z")

</div>

Team, A colleague asked me if I could write a script to: Read a text file where each record has two words. If the second word in the record is not 100% uppercase, write it to a file and convert it to uppercase. I w…

---

## [Hoe 1.8.1 Released](https://www.ruby-forum.com/t/hoe-1-8-1-released/151534)

<div class="topic-metadata">

**Author:** [@aguynamedryan](https://www.ruby-forum.com/u/aguynamedryan)\
**Replies:** 0\
**Last updated:** [October 22, 2008, 4:30pm UTC](https://www.ruby-forum.com/t/hoe-1-8-1-released/151534 "2008-10-22T16:30:42Z")

</div>

hoe version 1.8.1 has been released! http://rubyforge.org/projects/seattlerb/ http://seattlerb.rubyforge.org/hoe/ removed\_email\_address@domain.invalid Hoe is a simple rake/rubygems helper for project Rakefiles. It ge…

---

## [Rake Rule name problem](https://www.ruby-forum.com/t/rake-rule-name-problem/151321)

<div class="topic-metadata">

**Author:** [@jimb](https://www.ruby-forum.com/u/jimb)\
**Replies:** 7\
**Last updated:** [October 22, 2008, 3:51pm UTC](https://www.ruby-forum.com/t/rake-rule-name-problem/151321 "2008-10-22T15:51:11Z")

</div>

I my rake file a rule does not seem to produce a correct name. i.e. rule ‘.c’ do |t| p t.name #prints out ‘.c’ end Should this not be the name of the file it is going to produce i.e. blah.c Thanks, Jim.

---

## [Include code (conditionally) in a class and its subclasses](https://www.ruby-forum.com/t/include-code-conditionally-in-a-class-and-its-subclasses/151528)

<div class="topic-metadata">

**Author:** [@alfredogz](https://www.ruby-forum.com/u/alfredogz)\
**Replies:** 1\
**Last updated:** [October 22, 2008, 3:24pm UTC](https://www.ruby-forum.com/t/include-code-conditionally-in-a-class-and-its-subclasses/151528 "2008-10-22T15:24:54Z")

</div>

Hi. Is there a way to include code in a class and all its subclasses and get the behaviour as if it was included at the end of the code in each of them? Example: class Product\<ActiveRecord::Base def price 100 end …

---

## [Ruby Manor tickets now available](https://www.ruby-forum.com/t/ruby-manor-tickets-now-available/149986)

<div class="topic-metadata">

**Author:** [@nitr0z](https://www.ruby-forum.com/u/nitr0z)\
**Replies:** 3\
**Last updated:** [October 22, 2008, 3:19pm UTC](https://www.ruby-forum.com/t/ruby-manor-tickets-now-available/149986 "2008-10-22T15:19:59Z")

</div>

Firstly, apologies if you’ve already received this information. But in case you haven’t… Ruby Manor Registration Super Monkey Tiger Force, GO! Tickets for the most bad-ass’d Ruby shindig the Commonwealth has ever see…

---

## [Mechanize 0.8.4 Released](https://www.ruby-forum.com/t/mechanize-0-8-4-released/150078)

<div class="topic-metadata">

**Author:** [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Replies:** 8\
**Last updated:** [October 22, 2008, 11:33am UTC](https://www.ruby-forum.com/t/mechanize-0-8-4-released/150078 "2008-10-22T11:33:51Z")

</div>

mechanize version 0.8.4 has been released! http://mechanize.rubyforge.org/ http://github.com/tenderlove/mechanize/tree/master The Mechanize library is used for automating interaction with websites. Mechanize automati…

---

## [Rexml create a tag with literal characters](https://www.ruby-forum.com/t/rexml-create-a-tag-with-literal-characters/151510)

<div class="topic-metadata">

**Author:** [@ogtfaber](https://www.ruby-forum.com/u/ogtfaber)\
**Replies:** 1\
**Last updated:** [October 22, 2008, 11:17am UTC](https://www.ruby-forum.com/t/rexml-create-a-tag-with-literal-characters/151510 "2008-10-22T11:17:59Z")

</div>

I’m having a problem finding out how to parse literal characters into a new tag using rexml. I’m creating an excel xml document using rexml: xml.instruct! :xml, :version=\>“1.0”, :encoding=\>“UTF-8” In the document, I’m…

---

## [Packing algorithm in Ruby](https://www.ruby-forum.com/t/packing-algorithm-in-ruby/151449)

<div class="topic-metadata">

**Author:** [@captaffy](https://www.ruby-forum.com/u/captaffy)\
**Replies:** 6\
**Last updated:** [October 22, 2008, 10:53am UTC](https://www.ruby-forum.com/t/packing-algorithm-in-ruby/151449 "2008-10-22T10:53:52Z")

</div>

I have a simple problem in Rails, I need to pack lists of things onto the screen most efficiently. But it’s not really a Rails problem it’s a simple packing algorithm. Well not really that simple since the general pac…

---

## [\[Bug #672\] rb\_io\_flush in pipe\_open](https://www.ruby-forum.com/t/bug-672-rb-io-flush-in-pipe-open/151428)

<div class="topic-metadata">

**Author:** [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Replies:** 1\
**Last updated:** [October 22, 2008, 10:38am UTC](https://www.ruby-forum.com/t/bug-672-rb-io-flush-in-pipe-open/151428 "2008-10-22T10:38:00Z")

</div>

Bug #672: rb\_io\_flush in pipe\_open http://redmine.ruby-lang.org/issues/show/672 e$B5/I\<\<Te(B: Kazuhiro NISHIYAMA e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal e$B%+%F%4%je(B: core e$BD\>8e$Ne(Brb\_forke$B$NCf$Ge(B #de…

---

## [Warbler Help](https://www.ruby-forum.com/t/warbler-help/140084)

<div class="topic-metadata">

**Author:** [@FluidCoder](https://www.ruby-forum.com/u/FluidCoder)\
**Replies:** 8\
**Last updated:** [October 22, 2008, 9:41am UTC](https://www.ruby-forum.com/t/warbler-help/140084 "2008-10-22T09:41:48Z")

</div>

Hello, I have packaged up a simple Rails project into a .war file and deployed it to BEA Weblogic but I get an error and am not able to access it. I tried using warbler through a gem and a plugin and added all the …

---

## [Should I use instance\_eval or block.call](https://www.ruby-forum.com/t/should-i-use-instance-eval-or-block-call/151500)

<div class="topic-metadata">

**Author:** [@sentinel](https://www.ruby-forum.com/u/sentinel)\
**Replies:** 1\
**Last updated:** [October 22, 2008, 9:10am UTC](https://www.ruby-forum.com/t/should-i-use-instance-eval-or-block-call/151500 "2008-10-22T09:10:03Z")

</div>

I am writing a library that will be used by others. Have been reading a lot about procs/blocks etc, and the difference between block.call and instance\_eval pointed out in some articles was the context they are execute…

---

## [My coolest downloader](https://www.ruby-forum.com/t/my-coolest-downloader/151505)

<div class="topic-metadata">

**Author:** [@sexy\_fiona](https://www.ruby-forum.com/u/sexy_fiona)\
**Replies:** 0\
**Last updated:** [October 22, 2008, 8:37am UTC](https://www.ruby-forum.com/t/my-coolest-downloader/151505 "2008-10-22T08:37:14Z")

</div>

hello everyone…im fiona and i really love to download different movies and music…but downloading is very hassle you must need to wait an hour before you finished downloading…but it will never happen again…i already ha…

---

## [\[Bug #674\] Failure: test\_aset(TestSDBM)](https://www.ruby-forum.com/t/bug-674-failure-test-aset-testsdbm/151464)

<div class="topic-metadata">

**Author:** [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Replies:** 2\
**Last updated:** [October 22, 2008, 7:57am UTC](https://www.ruby-forum.com/t/bug-674-failure-test-aset-testsdbm/151464 "2008-10-22T07:57:23Z")

</div>

Bug #674: Failure: test\_aset(TestSDBM) http://redmine.ruby-lang.org/issues/show/674 e$B5/I\<\<Te(B: Kazuhiro NISHIYAMA e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Normal e$B%+%F%4%je(B: core Failure: test\_aset(TestSDBM) \[…

---

## [Code Review: transformfixes-1](https://www.ruby-forum.com/t/code-review-transformfixes-1/151492)

<div class="topic-metadata">

**Author:** [@John\_LSSIRONRUBY](https://www.ruby-forum.com/u/John_LSSIRONRUBY)\
**Replies:** 0\
**Last updated:** [October 22, 2008, 7:00am UTC](https://www.ruby-forum.com/t/code-review-transformfixes-1/151492 "2008-10-22T07:00:01Z")

</div>

tfpt review “/shelveset:transformfixes-1;REDMOND\\jflam” Comment : FYI: Fixes bugs in Rakefile external transform and updates IronRuby.sln to reference new ExtensionAttribute assembly.

---

## [Error Exception if script doesn't run](https://www.ruby-forum.com/t/error-exception-if-script-doesnt-run/151172)

<div class="topic-metadata">

**Author:** [@jackster](https://www.ruby-forum.com/u/jackster)\
**Replies:** 19\
**Last updated:** [October 22, 2008, 6:42am UTC](https://www.ruby-forum.com/t/error-exception-if-script-doesnt-run/151172 "2008-10-22T06:42:26Z")

</div>

I need to know if my script fails to run for any reason and capture the exception. I know how to use “rescue” for small pieces of code but how can I capture the stderr for anything in the script? thanks jack

---

## [Ruby1.9 on hppa build problem](https://www.ruby-forum.com/t/ruby1-9-on-hppa-build-problem/150732)

<div class="topic-metadata">

**Author:** [@Hideki\_Y](https://www.ruby-forum.com/u/Hideki_Y)\
**Replies:** 5\
**Last updated:** [October 22, 2008, 5:10am UTC](https://www.ruby-forum.com/t/ruby1-9-on-hppa-build-problem/150732 "2008-10-22T05:10:04Z")

</div>

e$B$3$s$K$A$O!"e(B e$B!!$d$^$M!we(BDebian JP Project e$B$G$9!#$A$g$C$H$4j$$$,$"$j$^$7$F%a!\<%k$r:9$7\>e$2$Fe(B e$B!!$$j$^$9!#e(B e$B!!e(BDebian e$B$G$Ne(B ruby 1.9 e$B$J$N$G$9$,!“e(Bhppa e$B$G%S%k%I$,$G$-$J$$$H$$$&LdB…

---

## [Marshal.load can't take GZipReader](https://www.ruby-forum.com/t/marshal-load-cant-take-gzipreader/151320)

<div class="topic-metadata">

**Author:** [@arton](https://www.ruby-forum.com/u/arton)\
**Replies:** 6\
**Last updated:** [October 22, 2008, 3:54am UTC](https://www.ruby-forum.com/t/marshal-load-cant-take-gzipreader/151320 "2008-10-22T03:54:01Z")

</div>

artone$B$G$9!#e(B 1.9.0e$B$G$9$,!"e(Bzlibe$B$Ne(BGZipReadere$B$K$Oe(Bgetbytee$B$,L$Dj5A$J$N$G!“e(BMarshl.loade$B$KM?e(B e$B$($k$H!“e(Binstance of IO neede$B$NNc30$H$J$j$^$9!#e(B e$B$H$j$”$($:$Oe(Bgetce$B$N%(%$%j%”%9$G…

---

## [Any serious attempts at ruby-to-javascript converters ongoing?](https://www.ruby-forum.com/t/any-serious-attempts-at-ruby-to-javascript-converters-ongoing/151485)

<div class="topic-metadata">

**Author:** [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Replies:** 1\
**Last updated:** [October 22, 2008, 3:19am UTC](https://www.ruby-forum.com/t/any-serious-attempts-at-ruby-to-javascript-converters-ongoing/151485 "2008-10-22T03:19:28Z")

</div>

I know that Ruby to JavaScript compilers have been played with a couple of times in the past, but was curious if there are any current serious efforts to build such a beast. Or if such a compiler already exists. Than…

---

## [Get 10000$+Bonus Without Investment](https://www.ruby-forum.com/t/get-10000-bonus-without-investment/151483)

<div class="topic-metadata">

**Author:** [@chinu](https://www.ruby-forum.com/u/chinu)\
**Replies:** 0\
**Last updated:** [October 22, 2008, 3:10am UTC](https://www.ruby-forum.com/t/get-10000-bonus-without-investment/151483 "2008-10-22T03:10:40Z")

</div>

hai, i am srinu from india. i am sending a blog url for yours use. Right side Of The Blog Awsurvey Banner will appear. click on the banner and get a free signup with 6$ bonus and you will get more surveys. once you …

---

## [Code Review: ParseTree5](https://www.ruby-forum.com/t/code-review-parsetree5/151411)

<div class="topic-metadata">

**Author:** [@grujildo](https://www.ruby-forum.com/u/grujildo)\
**Replies:** 2\
**Last updated:** [October 22, 2008, 2:37am UTC](https://www.ruby-forum.com/t/code-review-parsetree5/151411 "2008-10-22T02:37:55Z")

</div>

tfpt review “/shelveset:ParseTree5;REDMOND\\tomat” Comment : Bunch of tweaks to AST: removes some nodes that are notneeded any more, moves block argument out of Arguments to CallExpression, Fixes several bugs: ord…

---

## [Code Review: bugfixes-10](https://www.ruby-forum.com/t/code-review-bugfixes-10/151478)

<div class="topic-metadata">

**Author:** [@John\_LSSIRONRUBY](https://www.ruby-forum.com/u/John_LSSIRONRUBY)\
**Replies:** 1\
**Last updated:** [October 22, 2008, 1:21am UTC](https://www.ruby-forum.com/t/code-review-bugfixes-10/151478 "2008-10-22T01:21:18Z")

</div>

tfpt review “/shelveset:bugfixes-10;REDMOND\\jflam” Comment : Fixes find bug, adds thunks for system and system.drawing assemblies and forces ironruby to use MRI gem path

---

## [Threading best practices?](https://www.ruby-forum.com/t/threading-best-practices/151383)

<div class="topic-metadata">

**Author:** [@Dolazy](https://www.ruby-forum.com/u/Dolazy)\
**Replies:** 5\
**Last updated:** [October 22, 2008, 12:42am UTC](https://www.ruby-forum.com/t/threading-best-practices/151383 "2008-10-22T00:42:41Z")

</div>

I am developing a small GUI application using jruby. It will be used for testing API calls to my company’s server. I would like my application to execute server calls in a non-blocking way. In C++ I do this by creatin…

---

## [Stripping characters off a string](https://www.ruby-forum.com/t/stripping-characters-off-a-string/151450)

<div class="topic-metadata">

**Author:** [@chriscauser](https://www.ruby-forum.com/u/chriscauser)\
**Replies:** 7\
**Last updated:** [October 22, 2008, 12:40am UTC](https://www.ruby-forum.com/t/stripping-characters-off-a-string/151450 "2008-10-22T00:40:21Z")

</div>

Hi everyone, I know this is an easy question, but I want to know the best way to do this (i.e. the most Rubyesque). How do I strip the last four characters off a string of undetermined length? I’m sure it is a one …

---

## [Test/rinda/test\_rinda / test\_core\_03\_notify](https://www.ruby-forum.com/t/test-rinda-test-rinda-test-core-03-notify/151425)

<div class="topic-metadata">

**Author:** [@TAKANO\_Mitsuhiro](https://www.ruby-forum.com/u/TAKANO_Mitsuhiro)\
**Replies:** 3\
**Last updated:** [October 21, 2008, 11:39pm UTC](https://www.ruby-forum.com/t/test-rinda-test-rinda-test-core-03-notify/151425 "2008-10-21T23:39:23Z")

</div>

ã“ã‚“ã«ã¡ã¯ é«˜é‡Žã§ã™ã€‚ Rindaã®ãƒ†ã‚¹ãƒˆãŒFailã—ã¦ã„ã‚‹ã®ã§å°‘ã—çŠ¶æ³ã‚’è¦‹ã¦ã¿ã¾ã—ãŸã€‚ Loaded suite test/rinda/test\_rinda Started …F…F… Finished in 1.184625 seconds. Failure: test\_core\_…

---

## [Odd unit test error](https://www.ruby-forum.com/t/odd-unit-test-error/151456)

<div class="topic-metadata">

**Author:** [@Kenneth\_McDonald](https://www.ruby-forum.com/u/Kenneth_McDonald)\
**Replies:** 1\
**Last updated:** [October 21, 2008, 11:21pm UTC](https://www.ruby-forum.com/t/odd-unit-test-error/151456 "2008-10-21T23:21:04Z")

</div>

On one of my unit test errors, I’m getting the error message: NameError: uncaught throw ‘invalid\_test’ It’s the part about “uncaught throw ‘invalid\_test’” that I don’t get. That sounds like an error from the unit test…

---

## [Where is libopenssl-ruby](https://www.ruby-forum.com/t/where-is-libopenssl-ruby/151462)

<div class="topic-metadata">

**Author:** [@rubina](https://www.ruby-forum.com/u/rubina)\
**Replies:** 4\
**Last updated:** [October 21, 2008, 11:20pm UTC](https://www.ruby-forum.com/t/where-is-libopenssl-ruby/151462 "2008-10-21T23:20:30Z")

</div>

While installing Rails, I came across the fact that I need this library, libopenssl-ruby.I am running LINUX Suse: 2.6.16.21-0.8-smp ruby -v ruby 1.8.6 (2008-08-08 patchlevel 286) \[i686-linux\] Where can I get that lib…

---

## [Gems 1.3.0 updates itself every time?](https://www.ruby-forum.com/t/gems-1-3-0-updates-itself-every-time/151458)

<div class="topic-metadata">

**Author:** [@jay-levitt](https://www.ruby-forum.com/u/jay-levitt)\
**Replies:** 2\
**Last updated:** [October 21, 2008, 10:18pm UTC](https://www.ruby-forum.com/t/gems-1-3-0-updates-itself-every-time/151458 "2008-10-21T22:18:09Z")

</div>

On both my Mac (OS X 10.5.5) and my Linux box (Fedora Core 9), gems 1.2 needed the help of “gem install rubygems-update;update\_rubygems” to get to 1.3.0. Now, every time I do a “gem update --system”, it reinstalls 1.…

---

## [What's different between self.method and class \<\< self?](https://www.ruby-forum.com/t/whats-different-between-self-method-and-class-self/151424)

<div class="topic-metadata">

**Author:** [@rubyernewbie](https://www.ruby-forum.com/u/rubyernewbie)\
**Replies:** 5\
**Last updated:** [October 21, 2008, 9:38pm UTC](https://www.ruby-forum.com/t/whats-different-between-self-method-and-class-self/151424 "2008-10-21T21:38:38Z")

</div>

we can define a instance method in lots way. mostly, I saw people define like this: 1. class A def self.class\_method #some code here… end end class A class \<\< self def class\_method #some code here… end e…

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

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