/r/ruby
Celebrate the weird and wonderful Ruby programming language with us!
A sub-Reddit for discussion and news about Ruby programming.
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
/r/ruby
Hey everyone, I'm the owner of serverless-ruby.org. In 2016 it hosted a petition website to bring Ruby lang to FaaS world. Last couple of years it's not really doing anything.
Is anyone interested in doing something cool with it ? Post here or PM me. Thx
Started learning Ruby 2 weeks ago via codecademy just to get the basics down. Now on to more advanced resources in my own environment.
I'm on Windows so I set up Ruby via Ubuntu on WSL. I have created a project on my C drive (accessible in WSL via /mnt/c/) so that I can access it through Windows if needed.
Using RubyMine to open the project via the WSL option in Remote Development.
Does this check out to those who are experienced?
Edit: After some research I've realized its best to keep my projects in the WSL filesystem
Just wanted to share that I'm working on a simple recipe for self-hosting Auake III Arena JS securely with http2.
At present: only single player / multiplayer with bots is available. You can try out the current running instance here, press escape to enter the menu to play either available modes.
Working on the final piece: successfully routing the secure socket wss through the proxy.
Hey guys, I hope you're doing well.
(Context: I'm running this program in WSL2 Ubuntu environment)
I'm doing an inorder traversal on a Binary Search Tree. The method inorder takes the root node and traverses the tree. By traversing I mean printing all the nodes. But here's a catch. Instead of defining it this way, I defined the inorder method to take a block and based on this block, define what you mean by traversing.
This is where I'm having problem, inorder method has a yield(node) call to yield to block, IF you've provided the block. I'm providing it a block but still `block_given?` always return false. As a result, instead of printing all the nodes only root node gets printed.
Here's some code snippets, pertaining to above problem.
Here's the full code: https://github.com/atulvishw240/binary-search-tree
https://github.com/apicraft-dev/apicraft-rails
If you’re a Rails developer looking to simplify API development, Apicraft-Rails is here to transform your workflow.
Designed for API spec first development, this gem empowers teams to collaborate by generating dynamic mocks directly from OpenAPI specifications, ensuring your front-end and back-end can start integration without controller/action implementations.
With real-time contract validation, you can catch discrepancies early, preventing costly rework. Plus, it auto-generates stunning API documentation using SwaggerUI or Rapidoc, saving you time and effort.
Whether you’re building internal services or external APIs, it ensures a streamlined, reliable, and efficient API design process, all with seamless Rails integration.
Greetings,
I've been developing with Ruby on Rails for about 6 years, but I've never had a mentor and have always learned everything on my own. The problem is that sometimes I see code from other developers online, and compared to theirs, my code looks like it was written by someone who has been learning for less than a year. I always have the feeling of carrying a huge technical debt. What am I doing wrong? How can I reach that level?
I'll be starting on a contract project next week, and have always used rvm. They mentioned that they all use rbenv. Will there be any issues if I continue to use rvm, while they're using rbenv (all working on the same project)?
I'd like to parse my test files into blocks of text - Describe, context, it, etc - as happens when rspec runs. Is there a way to load a spec file and just parse the spec? Would a parser do that? Would I have to write something?
Apologies if this is a very known thing I'm missing
I'm in need of some linear algebra gem to solve a few physics related problems and I just found NMatrix. Problem is that the last commit dates from 7 years ago and I would like to know if people here would recommend a good, maintained alternative.
Lets say we have a unit test component with two tests: test_foo
and test_bar
. test_foo
will evaluate if function foo
works. test_bar
will use a result come from foo
and evaluate if function bar
works well. In this setup, I will expect test_bar
failed when test_foo
fails.
However, in unit testing practice we do not want to add dependencies between test units for some reason (Could anyone explain the reason as well?). If we had a dependency graph between each test units, then we can skip those obviously-will-fail tests and save our lifes. Do we?
On the other hand, what we can only do is create a dependency graph over all failure cases. This could probabily benifit the programmer by quickly locate the core issue in multiple cases. But in practice I never see people doing this or requiring such a feature. Is that just my obversation or people does not care about this?
It's true that we can always mock dependent class in a test unit. But think of a case I'm in the early stage of a package development and have unstable/experimental interface in my framework. In this case I want unit test captures and interface mismatch in function call sequence. If I'm mocking those experimental interface in unit testing, that means I need to modify those mocks every time I'm changing the interface. This will hugely increase the chance of making mistake on those test units. Then, what will be the best way to test those interfaces without having dependency?
Hi,
Would be nice to have a recursive Ruby syntax checker, in order to catch basic coding mistakes before they hit production.
Although many recommend a combination of UNIX find with xargs, that's fraught with many problems. Most of the relevant flags are nonportable. You have to search for not only .RB files, but also .ERB files. And Gemfiles. and Gemspec files. And extensionless files with Ruby shebangs. And the exit codes tend to slip.
This is perfect fodder for a dedicated linter, implemented in Ruby of course.
Does something already do that?
Hi,
Just for some context of my system:
Steps I took:1. rvm install 3.3.6 --with-openssl-dir=\
brew --prefix openssl`
2. gem install rails
When I try the command gem install rails
I get the following error:
ERROR: While executing gem ... (Gem::Exception)
OpenSSL is not available. Install OpenSSL and rebuild Ruby or use non-HTTPS sources (Gem::Exception)
/Users/rahulagarwal/.rvm/rubies/ruby-3.3.6/lib/ruby/3.3.0/rubygems/request.rb:53:in `configure_connection_for_https'
Things I have tried:
brew install openssl
brew upgrade openssl
Both of those yield the result that I am already on the latest version, which at this moment in time is openssl 3.4.0
Is there any advice to fix this? I have been trying different things the whole day to figure this out, I just can't for the life of me install ruby on rails.
Edit:
As a commenter suggested, here is a github gist for the console output that comes up when I try installing ruby.
https://gist.github.com/agarwalrahul1008/003e046232060da2283491fec5f98334
EDIT 2: SOLVED
Ok, so as pointed out by SleepingInsomniac, it was an issue with homebrew. Basically, after I migrated from my intel macbook to my new m4 macbook, it kept using my /usr/local homebrew version instead of /opt/bin. This basically meant that even though I had the relevant openSSL required to get ruby, it didn't matter, since I think it was located in the wrong brew library file.
FIX:
I basically deleted the old homebrew then reinstalled it. Then I used ASDF to install ruby and it went smoothly. Now I religiously pray that my projects that used stuff downloaded from my old homebrew still work.
Thanks so much for all the help everyone!