Skip to main content

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ruby]

Ruby is a multi-platform, open-source, dynamic, object-oriented, interpreted language created by Yukihiro Matsumoto (Matz) in 1993.

Filter by
Sorted by
Tagged with
3 votes
1 answer
62 views

Ruby Array#own_uniq method

I have implemented my own version of Ruby's Array uniq-method (Ruby docs - Class array) as a monkey patch on Array. Method-impl.: ...
michael.zech's user avatar
  • 5,044
4 votes
2 answers
110 views

Ruby: Implement an 'add_thirty_days'-method

Task: Implement a method, which receives an array of strings as argument. The strings are dates in the format "MM**DD**YYYY". For example: "11**03**2024". Add 30 to each of the ...
michael.zech's user avatar
  • 5,044
6 votes
2 answers
438 views

(Codewars) Goldbach's Conjecture (by @rsalgado) in Ruby

Link to kata: linkRank: 6 kyuKata author: @rsalgado I have been recently learning Ruby-lang and have been attempting to solve the following kata from Codewars involving Goldbach's Conjecture: ...
CrSb0001's user avatar
  • 619
4 votes
2 answers
240 views

Ruby Array#own_shuffle method

I have tried to implement the Array-shuffle method myself. Haven't had a look on some similar algorithm-examples by purpose and tried to figure out something myself. The actual Array-extension: ...
michael.zech's user avatar
  • 5,044
4 votes
1 answer
202 views

Fetching data from a REST-API then converting to CSV

I like to have a script which fetches data from a REST-API then writes the data into a CSV file. Here's what I've got so far (prototype, using a publicly accessible dummy-API): ...
michael.zech's user avatar
  • 5,044
2 votes
1 answer
67 views

Ruby 'mkdir_reports'-script for creating folder-/file-structure automated

Initial situation: Each week a nested folder-/file-structure has to be created. Content is added to the files. Afterward the structure is copied to a shared-folder for long-time documentation. Example:...
michael.zech's user avatar
  • 5,044
5 votes
3 answers
123 views

Ruby: Check for Palindrome (as Monkey-Patch on String-class)

I have written a method, which checks for Palindrome and attached it to the String-class. Here's the code: ...
michael.zech's user avatar
  • 5,044
3 votes
0 answers
48 views

Using Pundit Policy Scopes with Searchkick Results

We are using Searchkick to run our elasticsearch and Pundit to authorize users for specific actions. Below is our module SearchkickScope that does it's best to ...
Romuloux's user avatar
2 votes
1 answer
70 views

Rails session after migrate from PHP (improved)

previusly I make a post for Session Logic for User Verification in Rails Migration. Now the improvement version following advice of the comments is here. The problem was the use of `` for executing in ...
ZAMA's user avatar
  • 55
3 votes
1 answer
106 views

Session Logic for User Verification in Rails Migration

This is a logic to create sessions on RoR 7.1.2 based on the last version of the website which was in vanilla PHP, with the upgrade I have to deal with the users that were already signed up but not ...
ZAMA's user avatar
  • 55
1 vote
1 answer
112 views

Advent of Code Day 8

The task A file similar to the following is provided. ...
francesco's user avatar
1 vote
1 answer
68 views

Ruby-function for reading, parsing a text-file, removing data-duplicates

Task description: Implement a generate_unique_phone_numbers function. The function shall parse the given text-file. Content-example: ...
michael.zech's user avatar
  • 5,044
3 votes
3 answers
167 views

Print last lines of file

Task Write a Ruby function, which accepts a path to a text file and returns a string consisting of the last n lines in reversed order, separated by commas. Example input file: ...
michael.zech's user avatar
  • 5,044
1 vote
1 answer
162 views

The simple calculator in Ruby

I wrote the simple calculator in Ruby. This is my first program in this language. I've switched recently from Python to Ruby. What do you think about my work? Thanks ...
whiteman808's user avatar
1 vote
4 answers
256 views

Ruby FizzBuzz using the ternary operator two times

Task: Implement a function which loops from 1 to 100 and prints "Fizz" if the counter is divisible by 3. Prints "Buzz" if the counter is divisible by 5 and "FizzBuzz", ...
michael.zech's user avatar
  • 5,044

15 30 50 per page
1
2 3 4 5
108
Morty Proxy This is a proxified and sanitized view of the page, visit original site.