Questions tagged [ruby-1.8.7]

For issues relating to developing in Ruby, version 1.8.7.

Use this specific tag along with the generic one: .

202 questions
2
votes
2 answers

Equivalent of chmod +x in Ruby

In Linux, it is very easy "just" to add executable to a file, simply by input: chmod +x However, I have failed to find something as easy in the gems of Ruby. Of course, one could do a system call, i.e. system( 'chmod +x' << fname…
user1134991
  • 2,723
  • 2
  • 16
  • 25
2
votes
1 answer

Rescuing LoadError in Rails application

In my Rails 3 app, I am fetching path_info by: Rails.application.routes.recognize_path(url, { :method => request.request_method }) rescue {} If a crawler hits a URL like "http://localhost:3000/admin_", the above code raises following…
Utsav Kesharwani
  • 1,595
  • 10
  • 21
2
votes
0 answers

Ruby: Unicode issues with DBI gem

Why would a unicode encoding get lost when sending it to an ODBC-interface via the dbi-gem? We wrote an sinatra-application that connects via DBI to an SAP HANA database. The latter shouldn't matter as I can manually execute Statements with UTF8…
friedrich
  • 2,045
  • 1
  • 8
  • 12
2
votes
1 answer

undefined method `double' for

I have problem with using rspec-mocks. bundle list shows: Gems included by the bundle: * CFPropertyList (2.2.8) * builder (3.2.2) * bundler (1.7.12) * ci_reporter (1.9.3) * diff-lcs (1.2.5) * excon (0.44.0) * facter (2.4.0) * hiera…
kendriu
  • 403
  • 2
  • 16
2
votes
3 answers

visiting hash with keys from array

I have a big hash with lots of nested key value pairs. Eg. h = {"foo" => {"bar" => {"hello" => {"world" => "result" } } } } Now I want to access result and I have keys for that in array in proper sequence. keys_arr = ["foo", "bar", "hello",…
shivam
  • 14,497
  • 1
  • 47
  • 64
2
votes
3 answers

Right way to check if a constant is already defined in a Ruby Class

I have certain classes that are implemented as decorators in my Rails app which is on Ruby 1.8.7 . I keep getting the warning - warning: already initialized constant ABC . Here ABC is the name of the constant. To solve this, I'm using the…
boddhisattva
  • 5,836
  • 9
  • 44
  • 71
2
votes
3 answers

"ERROR: Failed to build gem native extension" when installing Cucumber 0.93

When I try to install cucumber 0.93 this error is triggered. I need to install this specific version. trabajo@fernando-Inspiron-1545:~/cucumber-rspec$ gem install cucumber -v 0.9.3 Building native extensions. This could take a while... ERROR: …
juan perez
  • 323
  • 5
  • 14
2
votes
1 answer

TypeError: Google is not a module

Im trying to implement google youtube api in my ruby on rails project as stated in youtube documentation https://developers.google.com/youtube/v3/code_samples/ruby#retrieve_my_uploads so this block of code require 'google/api_client' I get the…
Nasser
  • 23
  • 3
2
votes
2 answers

Why does Ruby gsub not replace a second occurrence of this pattern?

I have a bit of code for escaping double-quotes from a string which may include pre-escaped quotes; e.g: This is a \"string" Using the following code with Ruby 1.8.7p374: string.gsub!(/([^\\])"/, '\1\"') However, I get some funny edge-case when…
GeReV
  • 2,905
  • 6
  • 29
  • 44
2
votes
1 answer

flat_map in Ruby 1.8.7

Using Ruby 1.8.7, is there built-in functionality similar to Array.map which allows for the return of multiple values instead of just one? E.g. I have an array and each element contains an array - I want to end up with all values from the inner…
Josh M.
  • 23,573
  • 23
  • 96
  • 160
2
votes
2 answers

Ruby - Select modified values from array based on some condition

I know how select, collect and map work in Ruby. I was just wondering if there is a similar native Ruby method that can combine them & give results in a single iteration without having the need to remove nil from array? For ex. (1..10).map { |x| x*3…
Utsav Kesharwani
  • 1,595
  • 10
  • 21
2
votes
1 answer

Net::HTTP not sending request

I have the following method in our Ruby 1.8.7 project: def self.ping_server request_data = get_request_data uri = 'another_server.our_company.com' https = Net::HTTP.new(uri) https.use_ssl = true path = "/our_service" data =…
Kevin
  • 11,714
  • 18
  • 66
  • 107
2
votes
1 answer

Using durations as hash keys in Rails

Since I'm dealing quite a lot with durations in my Rails app, I would also like to use them as hash keys in some places. However, it does not seem to work as expected for me. Creating the initial hash works fine. For example, the following will…
dominos
  • 412
  • 10
  • 20
2
votes
1 answer

Match unicode text with Ruby 1.8.7

I have a regex that is used for matching unicode string and works pretty cool with all versions of Ruby newer than 1.8.7: /[\p{L}\p{Space}]+/u How it can be achieved with Ruby 1.8.7?
Sergey Kishenin
  • 4,969
  • 3
  • 28
  • 50
2
votes
2 answers

Travis fails now Rails 4 has been released

Here's the relevant part of my gemspec: spec.add_development_dependency "bundler", "~> 1.3" spec.add_development_dependency "rake" spec.add_development_dependency "rspec", "~> 2.13.0" spec.add_dependency "addressable" spec.add_dependency…
Pedro Nascimento
  • 11,336
  • 4
  • 30
  • 63
1 2
3
13 14