Questions tagged [ruby-1.9]

Ruby 1.9 is a shortcut for ruby versions 1.9.1, 1.9.2 and 1.9.3. Ruby is a dynamic language that focuses on simplicity and expressiveness.

Ruby is a dynamic language that focuses on simplicity and expressiveness.

Ruby 1.9 is the successor of Ruby version 1.8, there are the subversions 1.9.1, 1.9.2 and 1.9.3. The successor Ruby 2.0 was published 2013-02-24.

Ruby 1.9 is incompatible with Ruby 1.8, the succcessor Ruby 2.0 is intended to be fully backward compatible with Ruby 1.9.3.

Ruby 1.9 introduced new features like:

  • Per-string character encodings are supported
  • Block local variables (variables that are local to the block in which they are declared)
  • An additional lambda syntax
  • New socket API (IPv6 support)
  • require_relative import security
429 questions
0
votes
1 answer

Why does a fork in ruby 1.9.2 break memcached connections, but not in 1.8.7?

While upgrading a large project from 1.8.7 to 1.9.2, I have uncovered a bug that I am at a loss to explain. It appears the fork operation breaks a memcached connection, even when the memcached connection isn't used in the forked code. Here is an IRB…
esilver
  • 27,713
  • 23
  • 122
  • 168
0
votes
1 answer

Upgrading Rails 3 app from Ruby 1.8.7 to 1.9.3 stops respecting latin1 encoding specification in database.yml

I'm upgrading a Rails 3.2.13 application from Ruby 1.8.7-p370 to Ruby 1.9.3-p385. After upgrading, special characters are garbled in text retrieved from the database. For instance "café" appears as "café". My database is latin1 encoded. I'm using…
hoffm
  • 2,386
  • 23
  • 36
0
votes
4 answers

Ruby hash - how to use hash value when populating object?

For a pack of playing cards: How can I use the suit hash (below) when creating a pack? I have: class PackOfCards SUITS={H: 'Hearts', S:'Spades', D:'Diamonds', C:'Clubs'} CARDS=['A','2','3','4','5','6','7','8','9','10','J','Q','K'] …
junky
  • 1,480
  • 1
  • 17
  • 32
0
votes
1 answer

How to use the below description mentioned symbols?

Where are these symbols defined, and what are they used for? :w2_end :w2_beg :w1_beg :w1_end I found those in my IRB by using the line Symbol.all_symbols . My Ruby version and IRB versions are: C:\>ruby -v ruby 1.9.3p374 (2013-01-15)…
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
1 answer

Rack fails with Rails when I try to upload file (using paper clip) on Ruby 1.9

I have a Ruby on Rails application I'm using Ruby 1.9 and Rails 2.3.4 and I want users to upload videos so I installed Paperclip gem but I'm getting this error from Rack. The fact that it says it's "invalid byte sequence" makes me suspect that it's…
Tam
  • 11,872
  • 19
  • 69
  • 119
0
votes
2 answers

default value are not properly reflected for the same keys from 2 different but closely related ruby code

Please follow the below code : Part-I > h = { "a" => 100, "b" => 200 } => {"a"=>100, "b"=>200} > h.default = "Go fish" => "Go fish" > h["a"] => 100 > h["z"] => "Go fish" > h.default = proc do |hash, key| * hash[key] = key + key > end =>…
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
1 answer

Confusion with -T,-F,-K,-i commandline options in Ruby

Can you bit help me to understand how the below options work in real life? -T [level] -K [kcode] -F pat -i [ext]
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
2 answers

numbers as key in ruby 1.9.x syntax

How would I create a hash with numbers as keys under the new ruby syntax? for example {abc: 123} creates a hash with the symbol abc as the key, but {123: 'abc' } throws an exception (as does {123.to_sym: 'abc'}. The exception I see is syntax…
d-coded
  • 413
  • 3
  • 9
0
votes
1 answer

Rubinius Syntax Errors

While working with LocomotiveCMS using Rubinius I ran into a bunch of syntax errors. All were along the lines of expecting '|'. No one was posting issues about this so I figured I would ask: How do I resolve these issues? Is this a problem with…
Andrew Clarkson
  • 295
  • 1
  • 7
0
votes
2 answers

regular expression in ruby Regexp

I'm using ruby 1.9.2 string = "asufasu isaubfusabiu safbsua fbisaufb sa {{hello}} uasdhfa s asuibfisubibas {{manish}} erieroi" Now I have to find {{anyword}} How many times it will come and the name with curly braces. After reading Regexp I am…
manish nautiyal
  • 2,556
  • 3
  • 27
  • 34
0
votes
1 answer

How to test background process in RSpec?

Found this simple way to run a separate process in Sinatra: Run background process in Sinatra get '/start_process' @@pid = Process.spawn('external_command_to_run') end How would you test this in RSpec? Ruby 1.9.3.
B Seven
  • 44,484
  • 66
  • 240
  • 385
0
votes
2 answers

Practices for controlling a Ruby application "from the outside"

So, I have a long-running Ruby process, that does a wide variety of things, depending on what's it told to do (EventMachine TCP server with binary messages). Now, I would like to give certain people the ability to monitor, change, shut down the…
omninonsense
  • 6,644
  • 9
  • 45
  • 66
0
votes
2 answers

How MATURE is Ruby 1.9.3 on Ubuntu 12.04

Does anyone have a good guide to installing ruby 1.9.3 on Ubuntu that does use RVM? I have been developing in 1.8.7 for about a year, and am wanting to ugprade to 1.9.x. After spending countless hours trying to install 1.9, I reached a point of…
vanboom
  • 1,274
  • 12
  • 20
0
votes
1 answer

Nil can't be coerced into Fixnum

I have the following function: def valid_credit_card?(number) digits = number.scan(/./).map(&:to_i) check = digits.pop sum = digits.reverse.each_slice(2).map do |x, y| [(x * 2).divmod(10), y] end.flatten.inject(:+) (10…
dennismonsewicz
  • 25,132
  • 33
  • 116
  • 189
0
votes
2 answers

Ruby 1.9.3 - cannot load such file for some reason

Ruby 1.9.3 Very simple code and very simple question I can't deal with: gem list --local nokogiri (1.5.5) gem q --local nokogiri (1.5.5) But a ruby script (not Rails): require 'nokogiri' doc = Nokogiri.XML("some valid xml....") gives…
Alan Coromano
  • 24,958
  • 53
  • 135
  • 205