Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Ruby is a multi-platform, open-source, dynamic, object-oriented, interpreted language created by Yukihiro Matsumoto (Matz) in 1993.
0
votes
Testing #initialize of class Author
You should work on making your test cases rely on shared code as much as possible.
It's part of a larger strategy to make more 'testable' code. In your main application, if you have three similar met …
0
votes
Weekly job to create or update the lessons in all locations
One way to do it is to break out the nested loops using map to create snapshots of the array at different points in the transformation and then reference those using with_index.
def perform(*args)
…
2
votes
0
answers
560
views
A two-method program for running background jobs
I wanted to make a program for running background jobs (ruby scripts).
The goal was to continuously run a background script on an interval of N seconds until a kill command was issued. … class Backgrounder
def begin
tempfile_name = SecureRandom.urlsafe_base64
tempfile = Tempfile.new(tempfile_name)
tempfile_path = tempfile.path
tempfile_content = <<-RUBY …
1
vote
Accepted
Mini Test testing save on one and many trips
If you're writing verbose tests, your test suite will skyrocket in length.
There are worse problems to have but your best asset to address this problem is a comprehensive test_helper class.
It doesn …
2
votes
Accepted
REST API with Ruby on Rails and ReactJS
I think this is an interesting idea, although I haven't personally used it when building REST APIs.
Here's some code which shows how it could be done.
I tested the following code to ensure that it w …
2
votes
Easily interacting with two external apis
def bigcommerce_api_v3_get_customers_by_shop(shop, options = {})
Since you are only extracting a couple values from options here, consider using keyword params instead. It makes it more obvious what …
1
vote
2
answers
122
views
Combine arrays and preserve ordering - but prioritize one array's ordering over another
I have two arrays and I want to combine them both in a manner similar to this:
arr1 = "1a, 1b, 1c"
arr2 = "2a, 2b, 2c"
arr1.zip(arr2).flatten(1)
# => [1a, 2a, 1b, 2b, 3b, 3c]
That is, put each arr2 …
4
votes
Accepted
Use SRP to refactor this Ruby Class
To start out with all of the
require './lib/numeral_adders/<lib>
should be moved to a separate file like/lib/number_interpreter
Moving on, looking at repetitive parts of your code. The add_numer …
1
vote
Enumerating AWS instances in Rails, with error handling
The rescue in your fetch_aws_instances method is pointless. Rescuing errors just to re-raise them identically, is the same as not rescuing them at all.
You should only rescue when you want to custom …