Questions tagged [ruby-1.9.3]

For issues relating to developing in Ruby, version 1.9.3. If your question applies to Ruby in general, use the tag [tag:ruby].

Related tags

495 questions
0
votes
1 answer

Couldn't understand the Ruby command-line switch -0digit

From the doc -0digit => specifies the input record separator ($/) as an octal number. If no digits given, the null character is the separator. Other switches may follow the digits. -00 turns Ruby into paragraph mode. -0777 makes Ruby read whole file…
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
1 answer

Execute rails server from ruby app on Windows

I must execute a Rails Server (Rails version : 2.3.4, Ruby version : 1.8.7) from a Ruby script ( version 1.9.3). My ruby script is: system(start G:/app/Ruby187/bin/ruby.exe G:/app/name_app/script/server) When I started this script, I got this…
0
votes
5 answers

What is an eloquent way to sort an array of hashes based on whether a key is empty in Ruby?

array = [{ name:'Joe', foo:'bar' }, { name:'Bob', foo:'' }, { name:'Hal', foo:'baz' } ] What is an eloquent way to sort so that if foo is empty, then put it at the end, and not change the order of the other…
B Seven
  • 44,484
  • 66
  • 240
  • 385
0
votes
2 answers

Looking For Steps In Migrating Ruby 1.8.7 Web Application To Ruby 1.9.3

I am having an big old ruby on rails application ruby version - 1.8.7 (2011-06-30 patchlevel 352) rails version - 2.3.16 currently there is no plan in migrating rails version As far as i know the performance of ruby 1.9.x is 2 times faster than…
Sam
  • 685
  • 12
  • 34
0
votes
1 answer

Confusion with enum#with_index - starting offset index

a=[11,22,31,224,44].to_enum => # a.select.with_index{|x| puts x if x<2 } => [] a.with_index(2) => #:with_index(2)> irb(main):011:0> a.with_index(2){|x|…
DoLoveSky
  • 777
  • 1
  • 6
  • 17
0
votes
1 answer

How to click the Submit button which has no id and name using mechanize?

Find the below HTML code: How to click the Submit button which has no id and name using mechanize?
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
1 answer

Can the description mentioned code using Selenium-driver be implemented in mechanize?

Could anyone help me by giving small tips mentioning how the below can be written in Mechanize? I am totally new to the Gem Mechanize. require "rubygems" require "selenium-webdriver" driver = Selenium::WebDriver.for :firefox driver.get…
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
2 answers

what is the difference between regex anchors \< and \>?

I just introduced myself to Regex anchors \< and \> . But no code I found to see how they are used actually in a code. So in that context can you help me to understand with the help of a code how differently they meet the purposes? I found these…
Arup Rakshit
  • 116,827
  • 30
  • 260
  • 317
0
votes
4 answers

How %r(..) differs from /../ in Regexp creation in Ruby?

I am using Ruby1.9.3. I am newbie to this platform. From the docs I got to know we can make Regexp using the below : %r{pattern} /pattern/ Now is there any difference between the the two styles above mentioned, interms of fast pattern matching…
arun_roy
  • 601
  • 6
  • 16
  • 42
0
votes
1 answer

Ruby 'match()` method throwing an error "can't dump MatchData"

Interactive ruby ready. > time = /\A(?­(0\d|1[0-9­]|2[0-3]))­:(?([1-5]\d|0­\d))\Z/ => /\A(?(0\d|1[0-9]|2[0-3])):(?([1-5]\d|0\d))\Z/ > match = time.­match '11:3­0' => # I am trying…
DoLoveSky
  • 777
  • 1
  • 6
  • 17
0
votes
2 answers

How do I run a bash command and process its output in a resque worker?

I have a resque worker that stops all processing as soon as it has run a bash command. Here is my worker: class ProductJsonSaver @queue = :products def self.perform(id) product = Product.find(id) json = `phantomjs…
ankimal
  • 915
  • 3
  • 9
  • 22
0
votes
1 answer

How do \ / operator work in ruby Regular expression?

I am using Ruby 1.9.3. Just going thorugh the Ruby tutorials. Now I just got stuck to a statement on which regular expression is working and giving out put also. But confusion with the \/ operators logic. RegExp-1 Today's date is: 1/15/2013.…
DoLoveSky
  • 777
  • 1
  • 6
  • 17
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
2 answers

how hash key look up works recursively from backend?

I was playing to non-existence key of hash h1.but got surprised when i was seeing some errors and with their resolution.I wanted to know how the recursive call doing the job internally to handle the errors. Part-I here when tried h1[2][3] caused…
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