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…
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?
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…
Say I have...
arr = ["a", "b", "c"]
...and I want to move "a" between "b" and "c".
I currently do
arr.delete("a")
arr.insert(2, "a")
Can I do that in a single operation?
Thanks
When I do the following in Ruby 1.9.3 (also JRuby, Rubinius...), it works as expected:
enum = [1,2,3,4,5].each
#=> #
enum.next
#=> 1
If I try the same thing on Ruby 1.8.7 with backports, the following thing…
I'm using (and stuck with) the following version of Ruby:
ruby 1.8.7 (2012-06-29 patchlevel 370) [x86_64-linux]
I tried a lot of Googling, but I can't find a working answer to my problem. I'm importing a CSV file that will usually come from the…
I am encountering errors when I am using Ruby's File.exist? method in middleware. I have no idea why.
This is the background. I am improving some old webapp which hosts around 100GB of photos and growing. I need to replicate production environment…
I can't install ruby ree or ruby 1.8.7 on my Mac 10.8.2.
I did that:
$ brew install libksba
$ brew update
$ brew install autoconf automake
$ brew tap homebrew/dupes
$ brew install autoconf automake apple-gcc42
Then i try to install ruby 1.8.7 and i…
I want to get an xml content from a url (let's say http://stackoverflow.com). For this I use open uri. When I do
begin
status = Timeout::timeout(5) {
getresult = open("http://stackoverflow.com", "UserAgent" => "Ruby-OpenURI").read
}
rescue =>…
I am able to convert a local time in string format, to UTC time format. But when i save this utc time in my MySQL table, it is getting saved in a strange format.
t_utc = Time.parse('Mon Apr 23 03:00:23 -0700 2012').utc # => Mon Apr 23 10:00:23 UTC…
How can I do a regexp in ruby 1.8 that matches:
/my_dir/1/file
but not if I have:
/my_dir/1/deeper_stuff/file
So far I have
source_string = '/my_dir/1/index.html.erb'
/^\/my_dir/.match(source_string)
for the initial match, how do I add the…
Has anyone gotten ruby 1.8.7 working on Monterey with RVM?
I've tried every solution reported out there and nothing seems to work for me. I know 1.8.7 is totally deprecated and unsupported but there are many out there still on this version.
RVM…
I am using
ruby-1.8.7-p374,
rubygems - 1.8.29 and
rvm - 1.29.3
When I try to install any gem for example bundler, I get the following error
While executing gem ... (RuntimeError)
Marshal.load reentered at marshal_load
I want to use third party API and want to make a put and post request and get the response from API in my Rails Application
Ruby and Rails Version of My Application is Below -
Current Version of Ruby -1.8.7 and Rails 2.3.5
May I know which Gem…
I'm getting the following error:
/Users/user_name/.rbenv/versions/1.8.7-p375/lib/ruby/1.8/net/https.rb:124:in
`use_ssl=': uninitialized constant Net::HTTP::OpenSSL (NameError)
So, I opened up the https file and changed one thing just to see what…