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
4
votes
1 answer

Syntax error, unexpected ':', expecting ')'

I'm running into this syntax error with the below code and I can't figure out why ruby is complaining about it. def user_list server = Lumberg::Whm::Server.new( host: "localhost", hash: IO.read("/root/.accesshash") ) results =…
Striketh
  • 559
  • 1
  • 5
  • 17
3
votes
1 answer

Segmentation fault - Ruby 1.8.7 and Rails 3.1.3

I use the ruby 1.8.7 there are a good time, and I use this version of ruby with rails 3.0.x since of release of this version of rails. And I never got a Segmentation fault error. But now, after start develop the ruby 1.8.7 with the rails 3.1.3,…
3
votes
2 answers

Array#uniq with block equivalent in Ruby 1.8.7

Array#uniq has this behaviour in Ruby 1.9 c = [ "a:def", "a:xyz", "b:abc", "b:xyz", "c:jkl" ] c.uniq {|s| s[/^\w+/]} #=> [ "a:def", "b:abc", "c:jkl" ] It can take a block and give unique value with respect to what we give. But, this wont work in…
rubyprince
  • 17,559
  • 11
  • 64
  • 104
3
votes
1 answer

How to express Infinity in C in a ruby extension

I want to do the equivalent of ::Infinity= 1.0/0 in a ruby extension which is written in C. So far I have come up with rb_const_set(rb_mKernel, rb_intern("Infinity"), rb_float_new(1.0/0)); which gives me a compiler warning due to division by zero.…
johannes
  • 7,262
  • 5
  • 38
  • 57
3
votes
2 answers

Why isn't 'logger.debug false' printing anything?

I'm having a problem with a boolean expression and when I did a logger.debug I had strange results, so I simplified my logging code to the following and was surprised not to see any 'false' being printed. Logging code in my controller: logger.debug…
John MacIntyre
  • 12,910
  • 13
  • 67
  • 106
3
votes
2 answers

How do I parse the query portion of a URI in Ruby 1.8?

In Ruby 1.8, using the URI standard library, I can parse http://au.easyroommate.com/content/common/listing_detail.aspx?code=H123456789012&from=L123456789012345 using URI.split to get ["http", nil, "au.easyroommate.com", nil,…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
3
votes
1 answer

Using string[range]=new_val while respecting UTF8 in Ruby 1.8.7

I have code like text[from..to] = text_insertion The problem is that from and to are given counting UTF8 encoded characters as one char while the code above counts byte-wise in Ruby 1.8.7 I have to use Ruby 1.8.7 Which gem could I use to make my…
Richard Metzler
  • 545
  • 7
  • 17
3
votes
5 answers

Ruby: Sorting an Array, skipping the first element

I want to sort an Array of Arrays of Strings by the first String skipping the first Array but I just don't have an idea how to do it using the build-in sort method. I could copy the whole array without the first element and sort the resutling Array…
SimonH
  • 1,385
  • 15
  • 35
3
votes
2 answers

Preventing timeout when connecting to a URL

I want to see the time taken to access a url using Benchmark in the code below. I also tried to do the same thing without benchmark. That is, get time at start of test and end of test, subtract the two to get the time. Both methods end in the same…
Erran Morad
  • 4,563
  • 10
  • 43
  • 72
3
votes
2 answers

What version of capybara is compatible with Rails 2.3 and Ruby 1.8.7?

I'm trying to install capybara on a setup with Ruby 1.8.7 and Rails 2.3, but I received this message: capybara requires Ruby version >= 1.9.3. I have two questions. The more relevant question: What is the latest capybara version compatible with…
Arnold Roa
  • 7,335
  • 5
  • 50
  • 69
3
votes
2 answers

Convert time to other timezone

I have a datestring in this format yyyy-mm-ddThh:mm:ss[Z] And i have a timezone string. for e.g "Asia/Kolkata" Now i want to convert this date string into the timezone of the given timezone for e.g. if the date is 2014-01-03T23:30:00Z , then in…
Dheeraj Tyagi
  • 31
  • 1
  • 7
3
votes
1 answer

Serialization/Deserialization ruby object in YAML

I'm trying to understand the serialization/deserialization of ruby object using YAML under 1.8.7 and 1.9+ and have a few queries regarding it (I can't find much documentation on this) Ruby 1.8.7 class Element yaml_as…
Ratatouille
  • 1,372
  • 5
  • 23
  • 50
3
votes
3 answers

Difference in `Array#to_s` in Ruby 1.8 and Ruby 1.9

Possible Duplicate: Ruby 1.9 Array.to_s behaves differently? I wonder if anyone can tell me what changed between Ruby 1.8.7 and Ruby 1.9.3. I have an example listed below that behaves totally different in the 2 versions but according to the Ruby…
mpowmap
  • 651
  • 1
  • 6
  • 11
3
votes
3 answers

Right way to extract multiple values from string using regex in ruby 1.8

I'm relatively new to ruby and I'm trying to figure out the "ruby" way of extracting multiple values from a string, based on grouping in regexes. I'm using ruby 1.8 (so I don't think I have named captures). I could just match and then assign $1,$2 -…
zje
  • 3,824
  • 4
  • 25
  • 31
2
votes
2 answers

Ruby Object#send vs. negated equal

Why does "A".send('!='.to_sym, "B") raises a NoMethodError in Ruby 1.8.7 while "A" != "B"does not - and how would the correct syntax for Object.send look like?
user1196609
  • 33
  • 1
  • 5
1 2
3
9 10