229,142 questions
Score of 0
1 answer
76 views
User unexpectedly being logged out in test using Timecop after adding `expire_after` to session store
I have an RSpec system test like this:
before do
do_login
end
after do
Timecop.return
end
it 'does something' do
Timecop.freeze(Time.current.noon)
visit '/staff'
expect(page).to ...
Advice
0
votes
0
replies
48
views
How to autocorrect with rubocop in Neovim?
I'm using Lunarvim configuration for Neovim. This is my configuration repo.
The LSP for Ruby I'm using is Solargraph and this is my configuration:
---
include:
- Rakefile
- Gemfile
- "*.gemspec&...
Score of 2
1 answer
104 views
Gem::Version : Getting Argument Error, although I am passing the correct number of parameters
I have the code
class EmptyVersion < Gem::Version
def initialize
super('')
end
end
v = EmptyVersion.new
Running this produces:
'new': wrong number of arguments (given 0, expected 1) ...
Advice
1
vote
7
replies
214
views
Count the number of vowels in a text
A rookie in Ruby here. I'm trying to count the number of each vowel in a text entered by the user but I'm stuck. My code is this at the moment:
def count_vowels(phrase)
puts 'Enter a text:'
...
Tooling
0
votes
5
replies
78
views
A rubylang mode for the Jed editor (from jedsoft)?
I'm running the latest Jed editor from jedsoft.org under Debian 13 and under LinuxMint 22.3.
I want to create a mode in Jed for editing code in the Ruby language.
Before I try to "re-invent the ...
Score of 1
1 answer
111 views
How to parse and generate week strings for HTML week elements in Ruby/Rails? [closed]
HTML has a week selector <input type="week"> which provides a string such as 2026-W05 (Week 5 of 2026).
Ruby provides the strptime/strftime methods which seem to be able to handle this ...
Best practices
0
votes
10
replies
210
views
How to minimize number of lookups in a Hash?
say you want to find the first duplicate in an array. you could do something like this:
cnt = {};
[ 11, 22, 77, 22, 33 ].each_with_index { |x,i|
j = cnt[x]; ## <1>
break [x, j, i] ...
Score of 1
0 answers
59 views
Hanami db migrate
I'm following the Hanami tutorial documentation for building a web app.
I run bin/hanami db migrate and I get the following error:
=> database db/bookshelf.sqlite migrated in 0.2763s
Error: in ...
Score of 1
1 answer
66 views
msgpack gem failing to install on MacOS when running `bundle install`
I'm on MacOS Tahoe (26.3.1 (a)). I have a Ruby project which requires msgpack (1.4.2).
Unfortunately, when I run bundle install, I see:
Fetching msgpack 1.4.2
Installing msgpack 1.4.2 with native ...
Score of 1
1 answer
73 views
How to use existing chromium profile for ferrum?
I have setup chromium profile and wish to use that with ruby ferrum library. I copied complete configurations directory into /tmp and passed browser switched, but profile extensions seems to not work....
Tooling
0
votes
4
replies
132
views
Automating repetitive tasks with Ruby and Selenium WebDriver
I followed the advice from this question and I started to experimenting with Selenium, but I feel like it has to many limitations. Could you recommend something more suitable?
A simple program that ...
Score of 1
0 answers
224 views
Convert a string to only have regular alphabet characters, from any language
I had an issue this morning where someone was blowing up our school search function (which uses a MySQL MATCH function) by typing 'ðµð²ðµðµðð¬ð»ð¸ð¯ð½' into the school search. This is within the ...
Score of 0
1 answer
152 views
Regex Named Capture Group also Include Complete String
Is it possible to have a Regex include the whole string as a named capture group as well as individual named capture groups?
I am trying to parse IIS logs and can successfully extract the details I ...
Advice
0
votes
2
replies
159
views
New DataTypes For Ruby
I'm Alex. I program science I was in school and I have concepts of Datatypes which I would like to have in programming language.
Ruby is My Favorite languge (10+ years of experience), Are there any ...
Score of 4
1 answer
147 views
Rails 8.0.4 app build from scratch test ("bin/rails test") gives wrong number of arguments in line_filtering.rb
I started a new rails project and generated a model with
rails new nonono --css=bootstrap -j esbuild
bin/rails g scaffold State name
After that I run the test suite
bin/rails test
And got the ...