# Ruby

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

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

---

## [Neewby question: how to monitor a variable value](https://www.ruby-forum.com/t/neewby-question-how-to-monitor-a-variable-value/72979)

<div class="topic-metadata">

**Author:** [@Luc\_J](https://www.ruby-forum.com/u/Luc_J)\
**Replies:** 6\
**Last updated:** [October 21, 2006, 12:01am UTC](https://www.ruby-forum.com/t/neewby-question-how-to-monitor-a-variable-value/72979 "2006-10-21T00:01:45Z")

</div>

Hello All, I remember reading in a book that we could very easily monitor the value of a variable and have for instance an alert message displayed each time this variable s modified. I do not manage to find how to do …

---

## [Dependency 1.0.0](https://www.ruby-forum.com/t/dependency-1-0-0/73061)

<div class="topic-metadata">

**Author:** [@s0nspark](https://www.ruby-forum.com/u/s0nspark)\
**Replies:** 2\
**Last updated:** [October 20, 2006, 11:59pm UTC](https://www.ruby-forum.com/t/dependency-1-0-0/73061 "2006-10-20T23:59:44Z")

</div>

A Smalltalk-inspired dependency mechanism for Ruby. Like this: class StockWatcher include Dependency::Methods def initialize(stock) stock.express\_interest\_in :price, :for =\> self, :send\_back =\> :price\_changed …

---

## [Re: Easy way to check is sub!() succeeds?](https://www.ruby-forum.com/t/re-easy-way-to-check-is-sub-succeeds/73045)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 11:57pm UTC](https://www.ruby-forum.com/t/re-easy-way-to-check-is-sub-succeeds/73045 "2006-10-20T23:57:44Z")

</div>

But sub! always returns nil, even when it succeeds (in Perl, it will return the number of substitutions made, enabling “next if s/.$suf$//”) Er, no it doesn’t. irb(main):001:0\> s=“aaabbb” =\> “aaabbb” irb(main):00…

---

## [Re: metaprogramming surprise?](https://www.ruby-forum.com/t/re-metaprogramming-surprise/73064)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 0\
**Last updated:** [October 20, 2006, 11:23pm UTC](https://www.ruby-forum.com/t/re-metaprogramming-surprise/73064 "2006-10-20T23:23:38Z")

</div>

From: Garance A Drosehn \[mailto:removed\_email\_address@domain.invalid\] Any chance that class variables will disappear in Ruby 2.0? I’m only half joking. I use them fairly frequently, and have never been tripped up b…

---

## [Metaprogramming surprise?](https://www.ruby-forum.com/t/metaprogramming-surprise/72462)

<div class="topic-metadata">

**Author:** [@seeweer](https://www.ruby-forum.com/u/seeweer)\
**Replies:** 13\
**Last updated:** [October 20, 2006, 11:23pm UTC](https://www.ruby-forum.com/t/metaprogramming-surprise/72462 "2006-10-20T23:23:38Z")

</div>

Here comes some simple meta code class D @@e=5 @@f = 10 @@g = 20 class \<\< self attr\_reader :e attr\_accessor :g end def self.f @@f end def show print “\\nshow @…

---

## [MsSqlClient ActiveRecord Adapter initial gem-release!](https://www.ruby-forum.com/t/mssqlclient-activerecord-adapter-initial-gem-release/72946)

<div class="topic-metadata">

**Author:** [@sams](https://www.ruby-forum.com/u/sams)\
**Replies:** 4\
**Last updated:** [October 20, 2006, 10:27pm UTC](https://www.ruby-forum.com/t/mssqlclient-activerecord-adapter-initial-gem-release/72946 "2006-10-20T22:27:25Z")

</div>

First gem-release of the MsSqlClient. MsSqlClient is an ActiveRecord Database Adapter for Win32 systems connecting to Microsoft SQL Server (2000, 2005 \[Express\]). It’s much faster than the DBI adapter, and more import…

---

## [How to calculate file number in a folder](https://www.ruby-forum.com/t/how-to-calculate-file-number-in-a-folder/73046)

<div class="topic-metadata">

**Author:** [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/how-to-calculate-file-number-in-a-folder/73046 "2006-10-20T22:25:24Z")

</div>

Hi folks, I write a script to find out all the file names and the number of files in a folder(no other children folder) as following: Dir.open(‘C:/Ruby/self’).each{ |file| puts file if file=~/(\\w+)|(\\d+)/ # remove f…

---

## [Template question (easy)](https://www.ruby-forum.com/t/template-question-easy/73053)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 4\
**Last updated:** [October 20, 2006, 10:13pm UTC](https://www.ruby-forum.com/t/template-question-easy/73053 "2006-10-20T22:13:24Z")

</div>

So I originally took up a project of making a simple blog for myself and some friends to use to communicate with family while at college. I’ve got most of it finished code wise, I am now in the process of formatting t…

---

## [Re: how to calculate file number in a folder](https://www.ruby-forum.com/t/re-how-to-calculate-file-number-in-a-folder/73047)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 10:09pm UTC](https://www.ruby-forum.com/t/re-how-to-calculate-file-number-in-a-folder/73047 "2006-10-20T22:09:12Z")

</div>

From: Li Chen but I am not sure how to calculate the number of file in folder. Any help will be appreciated. Here’s one way. (There are many, I’m sure.) #Find all the entries in a directory irb(main):009:0\> Dir\[ ‘…

---

## [Re: Template question (easy)](https://www.ruby-forum.com/t/re-template-question-easy/73057)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 0\
**Last updated:** [October 20, 2006, 10:03pm UTC](https://www.ruby-forum.com/t/re-template-question-easy/73057 "2006-10-20T22:03:21Z")

</div>

From: removed\_email\_address@domain.invalid \[mailto:removed\_email\_address@domain.invalid\] I haven’t had much practice with partials yet. I assume from what I saw, a partial just grabs the little tiny segment of code I …

---

## [Libiconv: iconv\_open is missing?](https://www.ruby-forum.com/t/libiconv-iconv-open-is-missing/72948)

<div class="topic-metadata">

**Author:** [@mwalsh](https://www.ruby-forum.com/u/mwalsh)\
**Replies:** 6\
**Last updated:** [October 20, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/libiconv-iconv-open-is-missing/72948 "2006-10-20T21:29:54Z")

</div>

I’m relatively new to unix/osx/ruby so please be as gentle as you can…! I’m running Mac OSX Tiger. When I run ruby extconf.rb to try and install net-geoip-0.06 I keep getting the error ‘extconf failure: need libiconv…

---

## [Where to put require](https://www.ruby-forum.com/t/where-to-put-require/73009)

<div class="topic-metadata">

**Author:** [@ike](https://www.ruby-forum.com/u/ike)\
**Replies:** 4\
**Last updated:** [October 20, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/where-to-put-require/73009 "2006-10-20T20:41:11Z")

</div>

If I have a rails app and I need to put in require ‘xxx’ include yyy in my class ApplicationController \< ActionController::Base Where within this application.rb file do I put these lines? Thanks, Ike

---

## [Easy way to check is sub!() succeeds?](https://www.ruby-forum.com/t/easy-way-to-check-is-sub-succeeds/73042)

<div class="topic-metadata">

**Author:** [@nwiger](https://www.ruby-forum.com/u/nwiger)\
**Replies:** 0\
**Last updated:** [October 20, 2006, 8:41pm UTC](https://www.ruby-forum.com/t/easy-way-to-check-is-sub-succeeds/73042 "2006-10-20T20:41:11Z")

</div>

Hi all, I’m trying to port some Perl code to Ruby as part of learning the language. This code is part of a script called “untar”, which is a simple suffix-based wrapper around unzip/cpio/gunzip/tar/etc. It starts with…

---

## [Array trouble](https://www.ruby-forum.com/t/array-trouble/72878)

<div class="topic-metadata">

**Author:** [@gijs](https://www.ruby-forum.com/u/gijs)\
**Replies:** 7\
**Last updated:** [October 20, 2006, 8:40pm UTC](https://www.ruby-forum.com/t/array-trouble/72878 "2006-10-20T20:40:18Z")

</div>

Hi I want to add a value to an arrays’ values like this: ret = “” “abcd”.to\_a.each do |w| ret += " " end this gives =\> “abcd” in IRB but I expected it to give "a b c d " why doesnt this work as such? thanks gij…

---

## [ANN: JRuby 0.9.1](https://www.ruby-forum.com/t/ann-jruby-0-9-1/73039)

<div class="topic-metadata">

**Author:** [@Thomas\_E\_Enebo](https://www.ruby-forum.com/u/Thomas_E_Enebo)\
**Replies:** 0\
**Last updated:** [October 20, 2006, 8:12pm UTC](https://www.ruby-forum.com/t/ann-jruby-0-9-1/73039 "2006-10-20T20:12:56Z")

</div>

The JRuby team is pleased to announce the release of JRuby 0.9.1. Website: http://www.jruby.org/ Download: http://dist.codehaus.org/jruby/ This release has some significant improvements: Overall performance is 50-60…

---

## [Parsing Ruby to get info about method signatures?](https://www.ruby-forum.com/t/parsing-ruby-to-get-info-about-method-signatures/72927)

<div class="topic-metadata">

**Author:** [@Lyle\_J](https://www.ruby-forum.com/u/Lyle_J)\
**Replies:** 2\
**Last updated:** [October 20, 2006, 7:26pm UTC](https://www.ruby-forum.com/t/parsing-ruby-to-get-info-about-method-signatures/72927 "2006-10-20T19:26:46Z")

</div>

I’m interested in parsing some Ruby code for the purpose of extracting information about the method signatures (including argument names and default argument values). For example, if I had a method like: def foo(a, b=…

---

## [About require](https://www.ruby-forum.com/t/about-require/73019)

<div class="topic-metadata">

**Author:** [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 7:04pm UTC](https://www.ruby-forum.com/t/about-require/73019 "2006-10-20T19:04:42Z")

</div>

Hi folks, In Ruby why do we wirte code as require ‘enumerator’, instead of require ‘Enumerator’ with uppercase? What happens if ‘enumerator’ is not saved in the default path that Ruby usually looks for? Thanks, Li …

---

## [New To Ruby](https://www.ruby-forum.com/t/new-to-ruby/72905)

<div class="topic-metadata">

**Author:** [@Res\_P](https://www.ruby-forum.com/u/Res_P)\
**Replies:** 4\
**Last updated:** [October 20, 2006, 7:00pm UTC](https://www.ruby-forum.com/t/new-to-ruby/72905 "2006-10-20T19:00:41Z")

</div>

Hi Class I just installed the Ruby 1.8.5 One-Click Installer Stable version (recommended) for WinXp and accepted all the default installation options but when I run fxri I receive the following errors: . . . C:/r…

---

## [Re: about require](https://www.ruby-forum.com/t/re-about-require/73028)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 0\
**Last updated:** [October 20, 2006, 6:52pm UTC](https://www.ruby-forum.com/t/re-about-require/73028 "2006-10-20T18:52:40Z")

</div>

From: Li Chen Where is the default path that Ruby looks for? What if I want to ask Ruby also looks for another path? And in what format,with rb extension? http://phrogz.net/ProgrammingRuby/rubyworld.html#whererubyf…

---

## [Re: Problem modifying captured regexp results](https://www.ruby-forum.com/t/re-problem-modifying-captured-regexp-results/73022)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 6:40pm UTC](https://www.ruby-forum.com/t/re-problem-modifying-captured-regexp-results/73022 "2006-10-20T18:40:39Z")

</div>

From: Paul van Delst \[mailto:removed\_email\_address@domain.invalid\] So can someone elaborate on why the above split operation on captured regexp results seems to bugger up the other captured results? Does this issue …

---

## [Re: about require](https://www.ruby-forum.com/t/re-about-require/73021)

<div class="topic-metadata">

**Author:** [@phrogz](https://www.ruby-forum.com/u/phrogz)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 6:38pm UTC](https://www.ruby-forum.com/t/re-about-require/73021 "2006-10-20T18:38:54Z")

</div>

From: Li Chen In Ruby why do we wirte code as require ‘enumerator’, instead of require ‘Enumerator’ with uppercase? Because you are specifying the name of the file that the Enumerator class is in, not the class it…

---

## [Problem with reading file](https://www.ruby-forum.com/t/problem-with-reading-file/73014)

<div class="topic-metadata">

**Author:** [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Replies:** 3\
**Last updated:** [October 20, 2006, 6:22pm UTC](https://www.ruby-forum.com/t/problem-with-reading-file/73014 "2006-10-20T18:22:32Z")

</div>

Hi folks, I read a file in the following format,extract the second column only, and push them into an array. My problem is that Ruby reads them as strings(based on array.inspect) but not as numbers so it is impossible …

---

## [How to the output in 12x8 format](https://www.ruby-forum.com/t/how-to-the-output-in-12x8-format/72929)

<div class="topic-metadata">

**Author:** [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Replies:** 6\
**Last updated:** [October 20, 2006, 6:14pm UTC](https://www.ruby-forum.com/t/how-to-the-output-in-12x8-format/72929 "2006-10-20T18:14:30Z")

</div>

Hi folks, I have an array containing 96 elements. I want to print the array in 12x8 format. Any comments? Thanks in advance, Li

---

## [Erb does not work](https://www.ruby-forum.com/t/erb-does-not-work/72474)

<div class="topic-metadata">

**Author:** [@Minero\_A](https://www.ruby-forum.com/u/Minero_A)\
**Replies:** 5\
**Last updated:** [October 20, 2006, 6:04pm UTC](https://www.ruby-forum.com/t/erb-does-not-work/72474 "2006-10-20T18:04:24Z")

</div>

e$B@DLZ$G$9!#e(B String#each e$B$,$J$/$J$C$?1F6A$G!"e(Berb e$B$Ne(B trim\_mode=1, 2 e$B$,e(B e$B%(%i!\<$K$J$C$F$^$9!#e(B ~/src/ruby % ruby -v -I./lib -rerb -e ‘ERB.new("", nil, 2).result’ ruby 1.9.0 (2006-10-17) \[x86\_…

---

## [How to format an array](https://www.ruby-forum.com/t/how-to-format-an-array/72915)

<div class="topic-metadata">

**Author:** [@alex-osu3](https://www.ruby-forum.com/u/alex-osu3)\
**Replies:** 3\
**Last updated:** [October 20, 2006, 5:30pm UTC](https://www.ruby-forum.com/t/how-to-format-an-array/72915 "2006-10-20T17:30:15Z")

</div>

Hi all, I have an array \[1.0, 2.0, 3, 4,5,6\]. I want to format all the elements within the array into to this format “%5.3f”, that is 5 spaces/characters for each number/element, followed by 3 floating points. Any he…

---

## [Reverse Polish Ruby](https://www.ruby-forum.com/t/reverse-polish-ruby/73007)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 0\
**Last updated:** [October 20, 2006, 4:12pm UTC](https://www.ruby-forum.com/t/reverse-polish-ruby/73007 "2006-10-20T16:12:32Z")

</div>

Hey folks, So… all I wanted was an RPN calculator. So I wrote one. But, I thought, why should I reimplement +? Or -, sin, etc? So I decided to pass those requests along to Ruby. After that, my coworker joined in …

---

## [Modify instance variable in a method mixed in from external](https://www.ruby-forum.com/t/modify-instance-variable-in-a-method-mixed-in-from-external/72822)

<div class="topic-metadata">

**Author:** [@gnufied](https://www.ruby-forum.com/u/gnufied)\
**Replies:** 2\
**Last updated:** [October 20, 2006, 4:06pm UTC](https://www.ruby-forum.com/t/modify-instance-variable-in-a-method-mixed-in-from-external/72822 "2006-10-20T16:06:30Z")

</div>

I have this gem of a parser that does: def parse\_data data data.chomp! while data && data.length \> 0 data\_array = data.split(/\\r?\\n/,2) @chunked\_data \<\< data\_array\[0\] data = data\_array\[1\] if @chunked\_data =~ /(\\…

---

## [Having trouble connecting to a site via net/http](https://www.ruby-forum.com/t/having-trouble-connecting-to-a-site-via-net-http/72971)

<div class="topic-metadata">

**Author:** [@unknown](https://www.ruby-forum.com/u/unknown)\
**Replies:** 3\
**Last updated:** [October 20, 2006, 3:44pm UTC](https://www.ruby-forum.com/t/having-trouble-connecting-to-a-site-via-net-http/72971 "2006-10-20T15:44:26Z")

</div>

Hello, In my app I have the need to screen scrape a HTTPS page and I’m getting a strange error that I don’t understand. I can reproduce the error with a secure google page, which I do in the test code below. Any help…

---

## [Handle a pipe (|) character inside backticks?](https://www.ruby-forum.com/t/handle-a-pipe-character-inside-backticks/72922)

<div class="topic-metadata">

**Author:** [@Chris\_McMahon](https://www.ruby-forum.com/u/Chris_McMahon)\
**Replies:** 3\
**Last updated:** [October 20, 2006, 2:48pm UTC](https://www.ruby-forum.com/t/handle-a-pipe-character-inside-backticks/72922 "2006-10-20T14:48:05Z")

</div>

I can’t figure this out: ps efxl |grep “grep” 0 0 9095 2224 15 0 3684 672 pipe\_w S pts/1 0:00 | \_ grep grep…etc. but in IRB: irb(main):026:0\> r = ps efxl |grep "grep" =\> “” irb(main):027:0\> puts…

---

## [Ruby Sockets Vulnerable?](https://www.ruby-forum.com/t/ruby-sockets-vulnerable/72994)

<div class="topic-metadata">

**Author:** [@unni.tallman](https://www.ruby-forum.com/u/unni.tallman)\
**Replies:** 1\
**Last updated:** [October 20, 2006, 1:35pm UTC](https://www.ruby-forum.com/t/ruby-sockets-vulnerable/72994 "2006-10-20T13:35:25Z")

</div>

I have a TCPServer listening on a port. I forked a 500 odd TCP Clients and tried to connect to this TCPServer. Around 300 clients got connected, others gave the error : Connection timed out - connect(2)…

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

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