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

Is there a way to call ruby1.9 without loading rubygems?

So ruby 1.9 is really nice in that it'll automatically require rubygems, and hence when you call require 'somegem' without first requiring rubygems it'll work, and that's generally awesome. But I have a ton of shell scripts using ruby, and they…
kch
  • 77,385
  • 46
  • 136
  • 148
8
votes
5 answers

Write an atomic operation

I would like to execute some methods atomicity with Ruby, according to http://en.wikipedia.org/wiki/Atomicity_(database_systems) For instance, if I have: a = 30 b = 75 I would like to be able to do something like: atomic_operation do a += 10 b…
moshimoshi
  • 251
  • 1
  • 6
  • 15
8
votes
7 answers

Ruby Performance

I'm pretty keen to develop my first Ruby app, as my company has finally blessed its use internally. In everything I've read about Ruby up to v1.8, there is never anything positive said about performance, but I've found nothing about version 1.9. The…
Steve M
  • 10,517
  • 12
  • 52
  • 63
8
votes
1 answer

Where are methods defined at the ruby top level?

At the top level, method definition should result in private methods on Object, and tests seem to bear this out: def hello; "hello world"; end Object.private_instance_methods.include?(:hello) #=> true Object.new.send(:hello) #=> "hello…
horseyguy
  • 29,455
  • 20
  • 103
  • 145
8
votes
5 answers

Ruby 1.9.1-p234, Passenger 2.2.5, Rails 2.3-stable closed stream on POST request

I've setup Ruby 1.9.1 (p234) on a Ubuntu server. I'm trying to deploy a Rails app which vendors Rails 2.3-stable on Apache 2.2/Passenger 2.2.5. GET requests work fine, POST requests break immediately with the following log entry: Processing…
Christian
  • 302
  • 2
  • 8
8
votes
4 answers

HTML tidy/cleaning in Ruby 1.9

I'm currently using the RubyTidy Ruby bindings for HTML tidy to make sure HTML I receive is well-formed. Currently this library is the only thing holding me back from getting a Rails application on Ruby 1.9. Are there any alternative libraries out…
Christian
  • 302
  • 2
  • 8
8
votes
1 answer

autospec with multiple versions of Ruby

I've installed Ruby 1.9.1 alongside Ruby 1.8.6 on my Mac OS X Leopard using the prefix and program-suffix options so that I can run Ruby 1.9 stuff by issuing ruby19, irb19, gem19, etc. commands. I've installed the corresponding gems and can run…
Bart Jedrocha
  • 11,450
  • 5
  • 43
  • 53
8
votes
1 answer

C1 or C2 coverage tool for ruby

Is there any tool for C1 or C2 code coverage for Ruby (1.9)? SimpleCov supports only C0, but maybe there is another tool. I'm aware that a similar question has been asked here, but it was a couple years ago and I hope that something has changed.
mrzasa
  • 22,895
  • 11
  • 56
  • 94
8
votes
5 answers

Ruby grep with string argument

I want to use grep with a string as regex pattern. How can i do that? Example: myArray.grep(/asd/i) #Works perfectly. But i want to prepare my statement first searchString = '/asd/i' myArray.grep(searchString) # Fails How can i achieve this? I…
gkaykck
  • 261
  • 1
  • 3
  • 11
8
votes
2 answers

ruby 1.9 - what is easiest inverse of `string.codepoints.to_a`?

In ruby 1.9.3, I can get the codepoints of a string: > "foo\u00f6".codepoints.to_a => [102, 111, 111, 246] Is there a built-in method to go the other direction, ie from integer array to string? I'm aware of: # not acceptable; only works with…
Kelvin
  • 20,119
  • 3
  • 60
  • 68
8
votes
1 answer

Ruby clear screen

Possible Duplicate: How can I clear the terminal in Ruby? How to clear the terminal screen in ruby? puts "hello, what's your name?" input = gets.chomp <> puts "nice to meet you, #{input}"
Mr. Demetrius Michael
  • 2,326
  • 5
  • 28
  • 40
8
votes
4 answers

How can I match Korean characters in a Ruby regular expression?

I have some basic validations for usernames using regular expressions, something like [\w-_]+, and I want to add support for Korean alphabet, while still keeping the validation the same. I don't want to allow special characters, such as…
Jakub Arnold
  • 85,596
  • 89
  • 230
  • 327
7
votes
2 answers

How can I print the runtime stack trace of a Ruby 1.9 process?

Is there any way to print the runtime stack trace of a Ruby 1.9.x process? I know that there was a utility called pstack for Ruby 1.8, but the project appears to have been abandoned a couple years ago: https://github.com/ice799/pstack. Does anything…
Will Sulzer
  • 111
  • 1
  • 5
7
votes
2 answers

Why does ActiveRecord return fields encoded as ASCII-8BIT even with mysql2 gem?

I have been getting this error in Ruby 1.9, Rails 3.0, ActiveRecord 3.0: incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) This is happening because the string on which I'm trying to call gsub (which comes directly from an…
7
votes
3 answers

Why are all strings ASCII-8BIT after I upgraded to Rails 3?

I upgraded to RoR 3.0.1 and Ruby to 1.9.2. Now all the strings in my views are ASCII-8BIT? I believe I have my app set up to use UTF 8 application.rb config.encoding = "utf-8" database.yml development: adapter: mysql encoding: utf8 I'm…
jspooner
  • 10,975
  • 11
  • 58
  • 81