# Ruby

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

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

---

## [Dynamically mixins?](https://www.ruby-forum.com/t/dynamically-mixins/172910)

<div class="topic-metadata">

**Author:** [@navouri](https://www.ruby-forum.com/u/navouri)\
**Replies:** 5\
**Last updated:** [July 30, 2009, 8:44pm UTC](https://www.ruby-forum.com/t/dynamically-mixins/172910 "2009-07-30T20:44:36Z")

</div>

So I’m trying to figure out how I can allow an end user to decide which modules to mixin to a instance of a class, but I’m not sure if it’s possible. An example of what I would like. module Thing @bar = 5 end class…

---

## [Using until](https://www.ruby-forum.com/t/using-until/172663)

<div class="topic-metadata">

**Author:** [@llinklater](https://www.ruby-forum.com/u/llinklater)\
**Replies:** 16\
**Last updated:** [July 30, 2009, 8:43pm UTC](https://www.ruby-forum.com/t/using-until/172663 "2009-07-30T20:43:36Z")

</div>

I am writing a little thing to find all the prime numbers to a million. I got it to work this way: highestPrime = 1\_000\_000 primes = Array.new(highestPrime, true) currentNum = 3 while currentNum \< highestPrime do (…

---

## [\[Feature #1840\] Hash $B$KMWAGDI2C$7$F(B self $B$rJV$9%a%=%C%I(B](https://www.ruby-forum.com/t/feature-1840-hash-b-kmwagdi2c-7-f-b-self-b-rjv-9-a-c-i-b/172949)

<div class="topic-metadata">

**Author:** [@Kimura\_Yoshihiro](https://www.ruby-forum.com/u/Kimura_Yoshihiro)\
**Replies:** 1\
**Last updated:** [July 30, 2009, 7:36pm UTC](https://www.ruby-forum.com/t/feature-1840-hash-b-kmwagdi2c-7-f-b-self-b-rjv-9-a-c-i-b/172949 "2009-07-30T19:36:16Z")

</div>

Feature #1840: Hash e$B$KMWAGDI2C$7$Fe(B self e$B$rJV$9%a%=%C%Ie(B http://redmine.ruby-lang.org/issues/show/1840 e$B5/I\<\<Te(B: Kimura Yoshihiro e$B%9%F!\<%?%9e(B: Open, e$BM%@hEYe(B: Low e$BG\[Ns$+$ie(B Hash e$B$r:n$k$…

---

## [1.9 upper-case for constants?](https://www.ruby-forum.com/t/1-9-upper-case-for-constants/172978)

<div class="topic-metadata">

**Author:** [@stickstone](https://www.ruby-forum.com/u/stickstone)\
**Replies:** 0\
**Last updated:** [July 30, 2009, 7:17pm UTC](https://www.ruby-forum.com/t/1-9-upper-case-for-constants/172978 "2009-07-30T19:17:47Z")

</div>

I’m posting this here for some advice on whether this is a bug, or intentional behaviour. ruby 1.9.2-preview1 is quite capable of distinguishing Unicode upper-case characters. However this doesn’t seem to be used when …

---

## [\[Bug #1842\] mspec $B$G(B SIGABRT](https://www.ruby-forum.com/t/bug-1842-mspec-b-g-b-sigabrt/172976)

<div class="topic-metadata">

**Author:** [@Kazuhiro\_NISHIYAMA](https://www.ruby-forum.com/u/Kazuhiro_NISHIYAMA)\
**Replies:** 0\
**Last updated:** [July 30, 2009, 6:42pm UTC](https://www.ruby-forum.com/t/bug-1842-mspec-b-g-b-sigabrt/172976 "2009-07-30T18:42:59Z")

</div>

Bug #1842: mspec e$B$Ge(B SIGABRT http://redmine.ruby-lang.org/issues/show/1842 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 ruby -v: ruby 1.9.2dev (2009-07-31 t…

---

## [Ruby 1.8.6 puts outputs \\000 chars](https://www.ruby-forum.com/t/ruby-1-8-6-puts-outputs-000-chars/172970)

<div class="topic-metadata">

**Author:** [@john\_old](https://www.ruby-forum.com/u/john_old)\
**Replies:** 3\
**Last updated:** [July 30, 2009, 6:36pm UTC](https://www.ruby-forum.com/t/ruby-1-8-6-puts-outputs-000-chars/172970 "2009-07-30T18:36:33Z")

</div>

I recently updated my gem library, now a simple program outputs \\000 chars. What has changed and is causing the \\000 after each char output ? And how to correct the problem. Thanks for the help. ----- Snippet of inp…

---

## [Checking if String.scan does not match](https://www.ruby-forum.com/t/checking-if-string-scan-does-not-match/172965)

<div class="topic-metadata">

**Author:** [@alexamat](https://www.ruby-forum.com/u/alexamat)\
**Replies:** 1\
**Last updated:** [July 30, 2009, 4:44pm UTC](https://www.ruby-forum.com/t/checking-if-string-scan-does-not-match/172965 "2009-07-30T16:44:19Z")

</div>

Hi everyone, I’m extracting 3 words from a string delimited with colons using the following approach: str = “test:string:here” str.scan(/(.+):(.+):(.+)/) do |a, b, c| puts a, b, c end This works fine if all 3 word…

---

## [Trying to understand periodically\_call\_remote() javascript prototype helper](https://www.ruby-forum.com/t/trying-to-understand-periodically-call-remote-javascript-prototype-helper/172909)

<div class="topic-metadata">

**Author:** [@explainer](https://www.ruby-forum.com/u/explainer)\
**Replies:** 1\
**Last updated:** [July 30, 2009, 4:36pm UTC](https://www.ruby-forum.com/t/trying-to-understand-periodically-call-remote-javascript-prototype-helper/172909 "2009-07-30T16:36:49Z")

</div>

I have the following code snippet on the documents#index view page of my rails app. \<%= periodically\_call\_remote( :url =\> {:controller =\> ‘documents’, :action =\> ‘index’}, :update =\> ‘documents’, :method =\> ‘get’ ) …

---

## [Updating the search paths dynamically in script](https://www.ruby-forum.com/t/updating-the-search-paths-dynamically-in-script/172964)

<div class="topic-metadata">

**Author:** [@mdeering](https://www.ruby-forum.com/u/mdeering)\
**Replies:** 1\
**Last updated:** [July 30, 2009, 4:18pm UTC](https://www.ruby-forum.com/t/updating-the-search-paths-dynamically-in-script/172964 "2009-07-30T16:18:49Z")

</div>

hi, i’ve been including my libs using the RUBYLIB env variable, doing SET RUBYLIB=‘some path’ then running ir program.rb and it now has access to the files in ‘some path’ i also tried to do this dynamically in the r…

---

## [How to save string to a file as UTF-8](https://www.ruby-forum.com/t/how-to-save-string-to-a-file-as-utf-8/172931)

<div class="topic-metadata">

**Author:** [@bali](https://www.ruby-forum.com/u/bali)\
**Replies:** 4\
**Last updated:** [July 30, 2009, 4:15pm UTC](https://www.ruby-forum.com/t/how-to-save-string-to-a-file-as-utf-8/172931 "2009-07-30T16:15:50Z")

</div>

Below code: s1 = “good” File.new(“test.xml”, “w+”) \<\< s1 It always give a file ANSI encoded. How can I get it UTF-8 encoded? Thanks.

---

## [Using DBI and MySQL gems](https://www.ruby-forum.com/t/using-dbi-and-mysql-gems/150833)

<div class="topic-metadata">

**Author:** [@oweinh](https://www.ruby-forum.com/u/oweinh)\
**Replies:** 13\
**Last updated:** [July 30, 2009, 4:13pm UTC](https://www.ruby-forum.com/t/using-dbi-and-mysql-gems/150833 "2009-07-30T16:13:21Z")

</div>

Quick question: I thought using rubygems that to use the dbi and mysql to access a MySQL database from Ruby I would only have to do the following: gem ‘mysql’ gem ‘dbi’ and then I could do whatever, eg: dbh = DBI.c…

---

## [Assignments](https://www.ruby-forum.com/t/assignments/172956)

<div class="topic-metadata">

**Author:** [@ftf3k3](https://www.ruby-forum.com/u/ftf3k3)\
**Replies:** 3\
**Last updated:** [July 30, 2009, 3:50pm UTC](https://www.ruby-forum.com/t/assignments/172956 "2009-07-30T15:50:50Z")

</div>

Hello folks, I have a question about Ruby 1.8.7. After doing: a = b = 1 a += 1 a returns 2 and b returns 1. But if I try: a = b = \[\] a \<\< 1 both a and b returns \[1\]. Why? Regards

---

## [Thread exec](https://www.ruby-forum.com/t/thread-exec/172952)

<div class="topic-metadata">

**Author:** [@al\_S](https://www.ruby-forum.com/u/al_S)\
**Replies:** 3\
**Last updated:** [July 30, 2009, 3:43pm UTC](https://www.ruby-forum.com/t/thread-exec/172952 "2009-07-30T15:43:48Z")

</div>

Hi List, I’ve a problem with threads using exec, system or similar: … … domains = \[‘www.bim.com’,‘www.bum.com’,‘www.bam.com’\] … def check (host,domain,timeout) puts “checking… #{host} → #{domain}” timeout(timeout…

---

## [Wxruby problem](https://www.ruby-forum.com/t/wxruby-problem/172904)

<div class="topic-metadata">

**Author:** [@rainer](https://www.ruby-forum.com/u/rainer)\
**Replies:** 7\
**Last updated:** [July 30, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/wxruby-problem/172904 "2009-07-30T15:13:28Z")

</div>

Hello, I have a problem trying to get wxruby to work with Ruby 1.9.1 on Windows xp. I typed “gem install wxruby” I tried to run the sample “bigdemo.rb”, which had already been working under Ruby 1.8.6 some time ago. …

---

## [What is the Hash datatype in Ruby?](https://www.ruby-forum.com/t/what-is-the-hash-datatype-in-ruby/172947)

<div class="topic-metadata">

**Author:** [@prateekagarwal](https://www.ruby-forum.com/u/prateekagarwal)\
**Replies:** 3\
**Last updated:** [July 30, 2009, 2:28pm UTC](https://www.ruby-forum.com/t/what-is-the-hash-datatype-in-ruby/172947 "2009-07-30T14:28:52Z")

</div>

What is the Hash datatype in Ruby? And what is it used for? Can anyone please explain with an example.

---

## [Calling non generic method that has a generic overload](https://www.ruby-forum.com/t/calling-non-generic-method-that-has-a-generic-overload/172948)

<div class="topic-metadata">

**Author:** [@mdeering](https://www.ruby-forum.com/u/mdeering)\
**Replies:** 0\
**Last updated:** [July 30, 2009, 1:25pm UTC](https://www.ruby-forum.com/t/calling-non-generic-method-that-has-a-generic-overload/172948 "2009-07-30T13:25:28Z")

</div>

hi guys, i’m trying to using IR with NHibernate so i can a nice REPL experience. the issue i’m having is that I’m calling a method List() on the class ISQLQuery, which returns an IList, but ISQLQuery also has a generi…

---

## [Omnifocus 1.2.0 Released](https://www.ruby-forum.com/t/omnifocus-1-2-0-released/172939)

<div class="topic-metadata">

**Author:** [@aguynamedryan](https://www.ruby-forum.com/u/aguynamedryan)\
**Replies:** 0\
**Last updated:** [July 30, 2009, 11:16am UTC](https://www.ruby-forum.com/t/omnifocus-1-2-0-released/172939 "2009-07-30T11:16:17Z")

</div>

omnifocus version 1.2.0 has been released! http://rubyforge.org/projects/seattlerb Synchronizes bug tracking systems to omnifocus. Changes: 1.2.0 / 2009-07-30 3 minor enhancements: Added omnifocus\_new so I can …

---

## [Previous value in array block](https://www.ruby-forum.com/t/previous-value-in-array-block/172864)

<div class="topic-metadata">

**Author:** [@leveille](https://www.ruby-forum.com/u/leveille)\
**Replies:** 19\
**Last updated:** [July 30, 2009, 8:12am UTC](https://www.ruby-forum.com/t/previous-value-in-array-block/172864 "2009-07-30T08:12:30Z")

</div>

Is this a good way to use a previous value in an array block? I want to subtract the item(i) from item(i-1) of the array, a and return a new array of the results. Below is my attempt. a = \[1,3,3,2\] prev\_item = 0 b =…

---

## [Instance\_eval](https://www.ruby-forum.com/t/instance-eval/172878)

<div class="topic-metadata">

**Author:** [@abhishek](https://www.ruby-forum.com/u/abhishek)\
**Replies:** 4\
**Last updated:** [July 30, 2009, 7:04am UTC](https://www.ruby-forum.com/t/instance-eval/172878 "2009-07-30T07:04:56Z")

</div>

hii i’m using instance\_eval inside method\_missing to define a new method at run time. bt at the time of calling if i call newly defined method once it doesn’t give any value…so for getting the value from newly define…

---

## [Posting an XML document to a protected API](https://www.ruby-forum.com/t/posting-an-xml-document-to-a-protected-api/172788)

<div class="topic-metadata">

**Author:** [@maruthymukund](https://www.ruby-forum.com/u/maruthymukund)\
**Replies:** 9\
**Last updated:** [July 30, 2009, 6:35am UTC](https://www.ruby-forum.com/t/posting-an-xml-document-to-a-protected-api/172788 "2009-07-30T06:35:55Z")

</div>

I am working on the FrontEnd of a website and need to make a RESTful HTTP POST to a Backend system which checks for the presence of an API KEY and a SESSSION KEY in the request URL as part of the security model. Eg: T…

---

## [Johnson 1.1.2 Released](https://www.ruby-forum.com/t/johnson-1-1-2-released/172915)

<div class="topic-metadata">

**Author:** [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Replies:** 4\
**Last updated:** [July 30, 2009, 1:18am UTC](https://www.ruby-forum.com/t/johnson-1-1-2-released/172915 "2009-07-30T01:18:03Z")

</div>

johnson version 1.1.2 has been released! http://github.com/jbarnette/johnson http://johnson.lighthouseapp.com http://groups.google.com/group/johnson-talk Johnson wraps JavaScript in a loving Ruby embrace. It embeds th…

---

## [How to add a header to xml file](https://www.ruby-forum.com/t/how-to-add-a-header-to-xml-file/172903)

<div class="topic-metadata">

**Author:** [@bali](https://www.ruby-forum.com/u/bali)\
**Replies:** 1\
**Last updated:** [July 29, 2009, 10:54pm UTC](https://www.ruby-forum.com/t/how-to-add-a-header-to-xml-file/172903 "2009-07-29T22:54:37Z")

</div>

I have a ant build file: it needs to be changed to: \<?xml version="1.0" encoding="UTF-8" ?\> After processed, ant complains: D:\\googlecode\\balionweb\\test\>ant compile Buildfile: build.xml BUI…

---

## [Nokogiri 1.3.3 Released](https://www.ruby-forum.com/t/nokogiri-1-3-3-released/172872)

<div class="topic-metadata">

**Author:** [@aaronpowell](https://www.ruby-forum.com/u/aaronpowell)\
**Replies:** 2\
**Last updated:** [July 29, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/nokogiri-1-3-3-released/172872 "2009-07-29T18:32:56Z")

</div>

nokogiri version 1.3.3 has been released! http://nokogiri.org/ http://github.com/tenderlove/nokogiri/wikis http://github.com/tenderlove/nokogiri/tree/master http://groups.google.com/group/nokogiri-talk http://github.co…

---

## [Indexing hash with longer strings faster?](https://www.ruby-forum.com/t/indexing-hash-with-longer-strings-faster/172833)

<div class="topic-metadata">

**Author:** [@jablan](https://www.ruby-forum.com/u/jablan)\
**Replies:** 6\
**Last updated:** [July 29, 2009, 6:23pm UTC](https://www.ruby-forum.com/t/indexing-hash-with-longer-strings-faster/172833 "2009-07-29T18:23:34Z")

</div>

Hi, I have some wierd results measuring Ruby’s hash operations, particulary indexing hash using two member string array. Have a look: require ‘benchmark’ =\> false puts(Benchmark.measure do ?\> h = {} 1000000…

---

## [Encrypted using openssl executable, decrypting with ruby's OpenSSL module?](https://www.ruby-forum.com/t/encrypted-using-openssl-executable-decrypting-with-rubys-openssl-module/172799)

<div class="topic-metadata">

**Author:** [@Lloyd\_Z](https://www.ruby-forum.com/u/Lloyd_Z)\
**Replies:** 1\
**Last updated:** [July 29, 2009, 5:50pm UTC](https://www.ruby-forum.com/t/encrypted-using-openssl-executable-decrypting-with-rubys-openssl-module/172799 "2009-07-29T17:50:48Z")

</div>

I have some files on my system that have been encrypted using the “openssl” executable (via “openssl rc4 -e”), and I would like to decrypt them using the “OpenSSL” ruby module. I know that the salt and iv values are…

---

## [Test failure (test\_block.rb) in Ruby 1.9.2 preview1 on FreeBSD 6.0](https://www.ruby-forum.com/t/test-failure-test-block-rb-in-ruby-1-9-2-preview1-on-freebsd-6-0/172900)

<div class="topic-metadata">

**Author:** [@Hiroshi\_Ichikawa](https://www.ruby-forum.com/u/Hiroshi_Ichikawa)\
**Replies:** 1\
**Last updated:** [July 29, 2009, 5:26pm UTC](https://www.ruby-forum.com/t/test-failure-test-block-rb-in-ruby-1-9-2-preview1-on-freebsd-6-0/172900 "2009-07-29T17:26:13Z")

</div>

Gimitee$B$G$9!#e(B FreeBSD 6.0e$B\>e$Ge(BRuby 1.9.2 preview1e$B$Ne(Bmake teste$B$r\<B9T$9$k$H!"e(Btest\_block.rbe$B$G\<:GT$7$^$9!#e(B $ ./ruby --version ruby 1.9.2dev (2009-07-18 trunk 24186) \[i386-freebsd6.0\] $ make in…

---

## [Method question](https://www.ruby-forum.com/t/method-question/172892)

<div class="topic-metadata">

**Author:** [@sclarke](https://www.ruby-forum.com/u/sclarke)\
**Replies:** 4\
**Last updated:** [July 29, 2009, 5:15pm UTC](https://www.ruby-forum.com/t/method-question/172892 "2009-07-29T17:15:40Z")

</div>

Hi all, Struggling a little with the concept of an exercise I am doing. I have two Ruby methods, the first does a simple string replace the second converts data to something else if the criteria is satisfied. See exa…

---

## [Good way to not forget to install gems on a server?](https://www.ruby-forum.com/t/good-way-to-not-forget-to-install-gems-on-a-server/172802)

<div class="topic-metadata">

**Author:** [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Replies:** 11\
**Last updated:** [July 29, 2009, 3:41pm UTC](https://www.ruby-forum.com/t/good-way-to-not-forget-to-install-gems-on-a-server/172802 "2009-07-29T15:41:30Z")

</div>

I just broke my wife’s website (my current side project) because i was using a gem and i forgot to install it on the server before updating all of the application code and restarting it. Can anyone suggest a good way,…

---

## [GPS Tracking](https://www.ruby-forum.com/t/gps-tracking/172881)

<div class="topic-metadata">

**Author:** [@sijo](https://www.ruby-forum.com/u/sijo)\
**Replies:** 0\
**Last updated:** [July 29, 2009, 12:46pm UTC](https://www.ruby-forum.com/t/gps-tracking/172881 "2009-07-29T12:46:34Z")

</div>

Hi Is there any equivalent application in Ruby like this http://track.opengts.org/track/Track?page=login This is in Java Thanks in advance Sijo

---

## [How?](https://www.ruby-forum.com/t/how/172800)

<div class="topic-metadata">

**Author:** [@hunt](https://www.ruby-forum.com/u/hunt)\
**Replies:** 4\
**Last updated:** [July 29, 2009, 12:17pm UTC](https://www.ruby-forum.com/t/how/172800 "2009-07-29T12:17:49Z")

</div>

Hi friends, I am a new ruby programmer. I have a question for all of you, class ABC end As I read that Ruby is made in C. I checked the file class.c There one structure is defined as RClass struct RClass { struct…

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

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