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
10
votes
2 answers

ruby self.class.class_eval or singleton_class.class_eval

What is difference when I do class T def initialize self.class.class_eval do def test return self.class.object_id end end end end and class T def initialize singleton_class.class_eval do def test …
Fivell
  • 11,829
  • 3
  • 61
  • 99
10
votes
9 answers

Rails not using correct version of Ruby

New information This is what happens with rails console: Loading development environment (Rails 3.1.1) ruby-1.9.2-p290 :001 > RUBY_VERSION => "1.8.7" There's something really weird going on here - the prompt says 1.9.2 but RUBY_VERSION shows…
Skilldrick
  • 69,215
  • 34
  • 177
  • 229
10
votes
2 answers

Cleanup old refs in Ruby Version Manager (RVM)

I need to free disk space on my local machine, which is almost allocated into my Ruby Version Manager (RVM) dir. Now, it seems I got just one ruby version ( 1.9.2p136 ) : lsoave@ubuntu:~/rails/github/gitwatcher$ ruby -v ruby 1.9.2p136 (2010-12-25…
Luca G. Soave
  • 12,271
  • 12
  • 58
  • 109
10
votes
3 answers

Should I use Ruby 1.9.2 with my new web app?

Starting a new web app with Rails 3. I'm still relatively new to web development and have really enjoyed all the internet resources available to me while working in Ruby 1.8.7 and Rails 2.3.5. Any advice against using Ruby 1.9.2 on my new project?
ScotterC
  • 1,054
  • 1
  • 10
  • 23
10
votes
1 answer

Ruby 1.9.3 Dir.glob strange recursive match behaviour

Assuming a directory structure of: a/b/c/d/e/f/g/h I am trying to find 'h' via: Dir.glob('a/**/f/g/h') However this is not working. Any ideas? You can try the test case below: $ /usr/bin/ruby -v ruby 1.9.3p194 (2012-04-20 revision 35410)…
Jason Ling
  • 261
  • 2
  • 6
10
votes
2 answers

How to convert a Net::HTTP response to a certain encoding in Ruby 1.9.1?

I have a Sinatra application (http://analyzethis.espace-technologies.com) that does the following Retrieve an HTML page (via net/http) Create a Nokogiri document from the response.body Extract some info and send it back in the response. The…
humanzz
  • 897
  • 2
  • 10
  • 18
9
votes
2 answers

Can I dynamically define a Ruby method that takes a block?

I know that I can dynamically define methods on a class using define_method, and that I specify the parameters this method takes using the arity of the block. I want to dynamically define a method that accepts both optional parameters and a block.…
andrewdotnich
  • 16,195
  • 7
  • 38
  • 57
9
votes
2 answers

Undefined method 'on' for ActionModel

I'm getting the following error: NoMethodError in Users#new Showing .../app/views/users/form/_new.haml where line #7 raised: undefined method `on' for # The code in line 7 is: 7: = errors_for user,…
Patrick
  • 7,903
  • 11
  • 52
  • 87
9
votes
5 answers

Has anyone successfully deployed a Rails project with Ruby 1.9.1?

Last week I successfully completed the transition of all our company applications from Ruby 1.8.6 to Ruby 1.8.7 including local and remote configurations. From now on, development won't need to ensure backward-compatibility with Ruby 1.8.6. For the…
Simone Carletti
  • 173,507
  • 49
  • 363
  • 364
9
votes
8 answers

Without Converting to a String, How Many Digits Does a Fixnum Have?

I want find the length of a Fixnum, num, without converting it into a String. In other words, how many digits are in num without calling the .to_s() method: num.to_s.length
Orcris
  • 3,135
  • 6
  • 24
  • 24
9
votes
1 answer

Weirdness with gsub

I was trying to use gsub to remove non word characters in a string in a rails app. I used the following code: somestring.gsub(/[\W]/i, '') #=> "" but it is actually incorrect, it will remove letter k as well. The correct one should…
Ben
  • 171
  • 1
  • 8
8
votes
2 answers

Vim, Tabular and Ruby 1.9 Hashes

Assuming I have the following options Hash as an argument to a method in Ruby 1.9.x: my_method :arg1, some_option: "value 1" some_other_option:true option_three: 123 Using the Tabular VIM plugin, what would the regular expression be to get…
Michael van Rooijen
  • 6,683
  • 5
  • 37
  • 33
8
votes
2 answers

Why won't Ruby 1.9.2-head install using RVM?

I have been trying to install Ruby 1.9.2-head using RVM, but have been getting this error message: echo executable host ruby is required Is it compulsory to have system Ruby in order to install Ruby through RVM? I have all the dependencies given…
jayandra
  • 296
  • 2
  • 8
8
votes
2 answers

Error 'incompatible character encodings: ASCII-8BIT and UTF-8' due to 8-bit encoding of cookies (Rails 3 and Ruby 1.9)

I moved a web app that was using 1.8.7 to 1.9.2 and now I keep getting incompatible character encodings: ASCII-8BIT and UTF-8 I have the database encoding to UTF-8 and I have also 'config.encoding = "utf-8"'. I saw some ideas as possible…
Adolfo Builes
  • 501
  • 1
  • 3
  • 6
8
votes
2 answers

Globbing using braces on Ruby 1.9.3

Recent versions of Ruby support the use of braces in globbing, if you use the File::FNM_EXTGLOB option From the 2.2.0 documentation File.fnmatch('c{at,ub}s', 'cats', File::FNM_EXTGLOB) #=> true # { } is supported on FNM_EXTGLOB However, the 1.9.3…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338