Questions tagged [ruby-2.3]

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

Ruby 2.3.0 was released on on 25 Dec 2015. It is the first stable release of the Ruby 2.3 series.

It introduces some new features (like the safe navigation operator and frozen string literals) and various performance improvements. A description of new features in Ruby 2.3 is at https://www.ruby-lang.org/en/news/2015/12/25/ruby-2-3-0-released/.

This tag is intended for questions specific to version 2.3 of Ruby.

164 questions
3
votes
1 answer

Rails server is not starting due to invalid argument (errorno::EINVAL)

I'm facing this problem while starting rails server. ruby: 2.3.1 rails: 5.0.0.1 ubuntu 14.04 in windows linux subsystem. Thanks in advance. /home/devs/.rvm/gems/ruby-2.3.1/gems/rb-inotify-0.9.7/lib/rb-inotify/watcher.rb:74:in `initialize':…
Pradeep Sapkota
  • 2,041
  • 1
  • 16
  • 30
3
votes
1 answer

Ruby 2.3.1 Date.parse returns another date when separator is space char

Just got this today with my ruby console: $ irb 2.3.1 :001 > require 'date' => true 2.3.1 :002 > Date.parse '30/08/2016' => # 2.3.1 :003 > Date.parse '30 08 2016' => #
Mauricio Moraes
  • 7,255
  • 5
  • 39
  • 59
3
votes
2 answers

"sslv3 alert handshake failure" on ruby 2

I am trying to use a webservice with ruby, but it seems to be an issue with it's SSL configuration and ruby 2: >> require "open-uri" => true >>…
Lluís
  • 1,267
  • 1
  • 14
  • 36
3
votes
2 answers

Rails view path not being reset

Given Rails 4.2, Ruby 2.3.1. In theory, Rails should allow you to completely reset the view paths, as seen here, in the source code. However, when I reset the view_paths via #view_paths=, from a controller callback, something unexpected happens. >…
steel
  • 11,883
  • 7
  • 72
  • 109
3
votes
1 answer

sort_by array of hashes is not giving expected results in ruby

I have the below array arr = [ { nbr: "979276030", des: "CONF NO COST 30 Refi Plus <= 105 SM SRVR", status: "2C", milestone: "Processing", dt_time: "03/23/2016 12:00 AM", name: "Brad Pacocha" }, { nbr: "910482832", des: "CONF NO COST 30 Refi…
Chezhian
  • 773
  • 9
  • 15
3
votes
1 answer

Net::HTTP – Flush or Close

I've written a consumer for a payment API. My code simply issues a POST request and gets a response from the API. I've implemented that with Net::HTTP, here are the relevant lines of code: http = Net::HTTP.new(uri.host, 443) http.use_ssl =…
svoop
  • 3,318
  • 1
  • 23
  • 41
3
votes
2 answers

RSpec test of "wrong number of arguments" error fails in some environments

I have an issue in my test. I have this spec: context 'when no section is supplied' do it 'raises an ArgumentError regarding the missing section_id argument' do expect do described_class.with_section end.to…
Roberto Pezzali
  • 2,484
  • 2
  • 27
  • 56
3
votes
2 answers

What is the pre-Ruby2.3 equivalent to the safe navigation operator (&. or "ampersand-dot")?

The answers to every question I can find (Q1, Q2) regarding Ruby's new safe navigation operator (&.) wrongly declare that obj&.foo is equivalent to obj && obj.foo. It's easy to demonstrate that this equivalence is incorrect: obj = false obj &&…
user513951
  • 12,445
  • 7
  • 65
  • 82
2
votes
2 answers

Does inject starting from 0 mean the same as sum

I'm new to ruby and was going though a piece of code scope_value = {"tickets_scope"=>"1", "changes_scope"=>"8", "solutions_scope"=>"15"} scope_value.values.map { |i| 2** i.to_i }.inject(0, :|) I realised scope_value.values.map {|i| 2** i.to_i…
thebenman
  • 1,621
  • 14
  • 35
2
votes
1 answer

Class level constant broken in Ruby 2.3.4

I have some code that can be simplified to the following. It works on Ruby 2.3.3 and breaks on 2.3.4. It's slightly odd and I'd welcome suggestions on how to rewrite it as well as explanations as to why it breaks. require 'forwardable' class Dummy …
Yogh
  • 591
  • 6
  • 17
2
votes
2 answers

How to replace a string param with an array in Ruby?

How to do the following in Ruby? It does not work as expected because of pass-by-value params. def validate! msg if msg.is_a?(String) msg = [ msg ] end end #replace could be used if msg were being replaced with another string.
B Seven
  • 44,484
  • 66
  • 240
  • 385
2
votes
1 answer

find whether a zipped file is text or binary without unzipping it

I'm creating a ruby script which goes through several zip files and validates the content of any xml files within. To optimise my script, I'm using the ruby-zip gem to open the zip files without extracting them. My initial thought was to use…
eiko
  • 5,110
  • 6
  • 17
  • 35
2
votes
0 answers

Paperclip 5.1.0 - Rails 5 - appears missing, after the image upload

if I try to upload a picture message appears: "New Content 1 error prohibited this content from being saved: That cover has contents are not what they are reported to be " and then shows "missing" in Git Bash, appears: "[Paperclip] Content Type…
2
votes
0 answers

Net::OpenTimeout on Ubuntu with Ruby 2.3.3 and Rails 5

I'm in the process of upgrading our Rails app from Rails 4.2 to 5 and from Ruby 2.2.3 to 2.3.3. One of the delayed_job processes we use caches images from elsewhere on the web. The cached images are stored via s3-backed paperclip, but it seems like…
Kevin B
  • 43
  • 1
  • 4
2
votes
1 answer

How to capture the output of a command without it displaying in stdout

How can I capture the output of a command and check for what it says without the command displaying in stdout? For example: def update! `git pull origin master` if $?.exitstatus > 0 puts 'Failed to update' elsif…
User9123
  • 515
  • 2
  • 6
  • 14
1 2
3
10 11