Questions tagged [ruby-2.1]

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

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. Ruby 2.1 was released on Dec 25, 2013.

For information on Ruby in general, visit .

222 questions
3
votes
2 answers

what is the meaning of "#$e" in ruby 2.1.2

I have one string which is contain char like "Pi#$e77L09!($". But when i tried to print on Console its prints like "Pi!($" 2.1.2 :002 > str = "Pi#$e77L09!($" => "Pi!($" 2.1.2 :003 > puts str Pi!($ => nil
3
votes
1 answer

Ruby: shorter way to define instance variables

I'm looking for the shorter way to define instance variables inside the initialize method: class MyClass attr_accessor :foo, :bar, :baz, :qux # Typing same stuff all the time is boring def initialize(foo, bar, baz, qux) @foo, @bar, @baz,…
DreamWalker
  • 1,327
  • 1
  • 11
  • 19
3
votes
0 answers

rmagick CarrierWave 'Failed to manipulate with rmagick' for pdf file

I am trying to use rmagick to convert to pdf, but i am getting the error: [Failed to manipulate with rmagick, maybe it is not an image? Original Error: FailedToExecuteCommand `"gs" -q -dQUIET -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT…
Asaf Bar
  • 31
  • 1
3
votes
1 answer

How to create multiple columns per row in CSV with Ruby

Ok, I have a hash which contains several properties. I wanted certain properties of this hash to be added to a CSV file. Here's what I've written: require 'csv' require 'curb' require 'json' arr = [] CSV.foreach('test.csv') do…
WagnerMatosUK
  • 4,309
  • 7
  • 56
  • 95
3
votes
1 answer

Ruby 2.1.5 - GC tuning

I have Ruby 2.1.5 installed on my server and need to configure GC tuning variables for the best/optimum Ruby performance. Following is the hardware/software information information: Memory - 7697604 KB (8GB) CPU - Intel(R) Xeon(R) CPU E5-2670 v2 @…
3
votes
1 answer

Ruby Dir.glob issue only on Windows

This line: dirs = Dir.glob(some_file_path + '/' + '**' + '/') works as it should on OSX and linux. The same line on Windows: dirs = Dir.glob(some_file_path + '\\' + '**' + '\\') returns no directories. What am I doing wrong? I'm trying to get an…
almyz125
  • 648
  • 1
  • 7
  • 18
3
votes
3 answers

custom instance variable name in cancan's load_and_authorize_resource?

users_controller.rb class UsersController < ApplicationController def index @objects = User.filter(params: params) end end Q.1 > If 'load_and_authorize_resource' is called then what instance variable it will load ? Q.2 > If it loads…
codemilan
  • 1,072
  • 3
  • 12
  • 32
3
votes
1 answer

Issue with named arguments being marked as an error in Intellij for Ruby 2.x

Anyone else have a solution to this? IntelliJ freaks out when I use the new named arguments feature for ruby 2 in a method def initialize(ini_url:, rundeck_url:, environment:, user:) end Or when calling a method supplying the named…
bergyman
  • 4,480
  • 3
  • 23
  • 32
3
votes
1 answer

Unicorn and Gemfile are using different ruby versions when trying to run unicorn and Nginx on Digital Ocean

I am trying to run my Rails app through Nginx and Unicorn and when I try to run service unicorn start it tells me I fail with master failed to start, check stderr log for details. My Gemfile specifies ruby 2.0.0 and my ruby versions is 2.0.0p353.…
3
votes
1 answer

Ruby 2.1.3 installation in Ubuntu 14.04.1 hang?

Anyone has this problem where the installation of Ruby 2.1.3 in Ubuntu 14.04.1 hang (using rvm). This where it hangs: root@ubuntu:~# rvm install 2.1.3 ruby-2.1.3 - #removing src/ruby-2.1.3.. Searching for binary rubies, this might take some time. No…
resting
  • 16,287
  • 16
  • 59
  • 90
3
votes
1 answer

Did Ruby break backward compatibility with the release 2.1.3 around if-else expressions?

I recently upgraded to Ruby 2.1.3 and to my surprise I started getting some syntax errors. The smallest instance of the problem can be seen here: {blah: if true then :bleh end} which in Ruby 2.1.2 produces: => {:blah=>:bleh} while in 2.1.3…
Pablo Fernandez
  • 279,434
  • 135
  • 377
  • 622
3
votes
1 answer

Ruby upgrade (from 1.8.7) on Rails 3.0.20 application causing time zone weirdness

I'm upgrading an big, old, clunky Rails application's Ruby (mostly so I don't have to re-install REE on my reformatted laptop) and I'm getting bitten pretty badly by timezone issues. Basically, pulling datetimes out of the database is not…
3
votes
1 answer

how to specify asset_host in rails 4?

I am using Amazon S3 for file uploads and Cloudfront for serving static assets, and in my config/environments/staging.rb, i wrote ActionController::Base.asset_host = Proc.new { |source| if source.include?('/assets') …
3
votes
4 answers

How install ruby 2.1.0 on OS_X 10.9 using rvm? ( No binary rubies available for: osx/10.9/x86_64/ruby )

I'm trying to install ruby 1.9.3-p545 or ruby-2.1.0 or ruby-2.1.1, but it fails... My environment: OS_X 10.9 x86_64 rvm 1.25.20 Error from terminal: bmalets$ rvm install 1.9.3-p545 Searching for binary rubies, this might take some time. No…
bmalets
  • 3,207
  • 7
  • 35
  • 64
3
votes
1 answer

Rails Install Fails With Ruby 2.1

I've just installed Ruby 2.1 using the instructions here for OSX: https://github.com/postmodern/chruby/wiki/Ruby Everything appears to be working fine and I've installed a few gems without issue. However, when installing rails using: $ sudo gem…
Undistraction
  • 42,754
  • 56
  • 195
  • 331