Questions tagged [ruby-1.8]

For issues relating to developing in Ruby, version 1.8. If your question applies to Ruby in general, use the tag [tag:ruby].

Ruby is an open-source dynamic object-oriented interpreted language created by Yukihiro Matsumoto (Matz) in the 1990s.

Related tags:

140 questions
1
vote
1 answer

Convert 2 arrays to 1 hash

array1 = [1,2,3,4] array2 = [true,false,true,false] expected output : [:1 => true, :2 => false, :3 => true, :4 => false] Would like to make the array1 values as keys of the hash and array2 values as the hash values. Using ruby 1.8 Can someone…
Ross
  • 109
  • 2
  • 10
1
vote
1 answer

Supporting newer gems on old ruby (here: Celluloid)

Is it possible, by using backports or something similar, to install and use gems that require a higher version of ruby than what is installed? I am stuck on 1.8 and I am having troubles with the celluloid gem in relation with rspec. I thought that…
Automatico
  • 12,420
  • 9
  • 82
  • 110
1
vote
0 answers

Can't list source using debug in ruby 1.8

I have a very simple ruby program (tmp.rb) I'm trying to debug: puts "a" puts "b" puts "c" require "debug" puts "d" puts "d" puts "e" When I run it, it enters the debugger interactive mode: a b c Debug.rb Emacs support available. tmp.rb:5: (rdb:1)…
loopbackbee
  • 21,962
  • 10
  • 62
  • 97
1
vote
1 answer

How to get code of unicode character using Ruby 1.8.6?

If I add this to the beginning of my script: $KCODE = 'UTF8' require 'jcode' then I can walk over every char of a word containing unicode characters. Imagine a word containing umlauts or something, and I iterate over them like this: word.each_char…
Geo
  • 93,257
  • 117
  • 344
  • 520
1
vote
2 answers

illegal switch in RUBYOPT: -E (RuntimeError)

I keep getting this error in codekit when trying to compile my project and have no idea what it means: System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: illegal switch in RUBYOPT: -E (RuntimeError) Does anyone have any idea on how…
s1mcity
  • 383
  • 1
  • 3
  • 5
1
vote
1 answer

Splat in non-final position

For the following method def mixed_args(a,b,*c,d) puts a,b,c,d end p mixed_args(1,2,3,4,5) I get this error message: syntax error, unexpected tIDENTIFIER, expecting tAMPER or '&' Could you give me a hint what information I am missing?
1
vote
2 answers

Is there a simple way to iterate through pairs in a Ruby hash in order of addition (i.e. oldest first)?

I create an empty hash chickens, and key-value pairs are then added over time. chickens = {} chickens.merge!("Davison"=>"plucky") chickens.merge!("Mortimer"=>"sullen") chickens.merge!("Chauncey"=>"forlorn") for name,mood in chickens do puts…
user2493615
  • 317
  • 1
  • 8
1
vote
0 answers

Error in Installing redmine 1.1.2

I have to install redmine 1.1.2 and for that the rails version should be 2 and ruby version should be 1.8.7. And now as we moved to the rails 3 and ruby 1.9 +, I am getting many errors in installing redmine 1.1.2. And now I am getting an…
railsman
  • 132
  • 2
  • 14
1
vote
2 answers

Using instance_exec and converting a method to a Proc

I can take a block of code, instance_exec it, and get the proper result. I would like to take a method off a different object and call one of it's methods in my scope. When I take a method from a different object, turn it into a proc, and then…
BeepDog
  • 5,016
  • 2
  • 24
  • 33
1
vote
4 answers

Empty range between strings representing numbers

Here are two range values. ('1'..'10').to_a => ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] but, ('2'..'10').to_a => [] Why does the second one return an empty array in ruby 1.8.7?
Inaccessible
  • 1,560
  • 3
  • 18
  • 42
1
vote
3 answers

Which one is a Ruby deprecated proc?

In the book Programming Ruby: The Pragmatic Programmers Guide by Dave Thomas with Chad Fowler and Andy Hunt, regarding the creation of Procs there is a footnote that states: "There’s actually a third, proc, but it is effectively deprecated." I…
Davit
  • 1,394
  • 5
  • 21
  • 47
1
vote
0 answers

ActiveRecord::AssociationTypeMismatch ruby 1.8 without using spork

I have models specs, controllers spec and request spec. When I run: rspec spec models spec are run first, then request and then when controller specs are run the specs for the first controller are OK, but the next fail. But when I run…
1
vote
6 answers

Combining arrays without product method

I have two arrays a = [1,2,3,4] b = [a,b,c,d,e,f] that I need to combine to create: c = [[1,a],[1,b],[1,c],[1,d],[1,e],[1,f],[2,a],[2,b],...] I would use the product method with Ruby version 1.9 or later, but I am running an old version of Ruby,…
ryan1393402
  • 715
  • 1
  • 6
  • 9
1
vote
1 answer

Differences between Ruby 1.8 vs 1.9 in list's element comparison

The two Ruby versions are: 1.8.7 (which the school uses) vs. 1.9.3 (current version, that I have on my system). Just curious on what is different in 1.9.3 that makes the following not work properly. The function outputs true if all the elements in…
Luigi
  • 45
  • 1
  • 8
1
vote
1 answer

Installing gems in Mac OS X pre-installed ruby 1.8.7

Macs seem to all come with ruby 1.8.7 pre-installed. That's fine for my purposes, but when I install gems with either gem install gem-name or sudo gem install gem-name, I have to explicitly add the gem's lib directory to my $LOAD_PATH at the top of…
at.
  • 50,922
  • 104
  • 292
  • 461