Weird behaviour of initialize ruby method [closed]
I'm playing with code from Sandy Metz OOP book. So I've wrote this class:class Gear attr_reader :chainring, :cog, :rim, :tire def initialize(chainring, cog, rim, tire) p chainring p cog p rim p tire...
View ArticleUsing Ruby and Sinatra, Is it possible to use HAML in an "internal" or...
I've done gem install sinatra and gem install hamlAnd I have this .rb filerequire 'sinatra'get '/abc2' do"<b>aaaaaaaaaaaaa</b>"endNow say I want that line of HTML but in HAML. and not...
View ArticleDeadlock conflict Ruby [duplicate]
I'm trying to set up a development environment for Dart and Flutter. When installing cocoapods, there is a conflict between several threadsdimabeglov@MacBook-Air-Dmitrij ~ % pod --versionTraceback...
View ArticleIn Ruby how can I check if a symbol is in an array of symbols? [closed]
Can I do the following? If so how?I have an array of symbolssymbols = %w{:sym1 :sym2 :sym3} # is this correct implementation?# I'm putting this in a function for this illustrationdef...
View ArticleApplication specs are slow when upgrading to ruby 3.2.2 and 3.3.0 from 3.1.4
I am in the process of upgrading ruby version from v3.1.4 to v3.2.2The specs take 18-19 minutes on v3.1.4, but they run for about 45-47 minutes v3.2.2This is one of the logs i see in test.log when...
View ArticleHow can I make Ruby Gosu properly load a file path with variables to...
Currently, I have this issue where I need to load the music files into ruby so that it can be played.While it works with absolute path, it doesn't work when I use variables to represent the file path...
View ArticleTesting custom exception with a single expect?
I have a function that I want to test raises an exception on an input, but that exception also carries some more information than just a plain message, and I want to test that too. So I did something...
View ArticleHow do I stub method_options using Rspec?
Class CLI < Thor desc "run [age]" "user passes age" method_option :age,type:'numeric' def run variable=options[:a] if options[:a].present? call_method(a) endendHow do I mock options[:a] using Rspec...
View ArticleRequire a gem in rails
I'd like to include unitwise in my project, so I added it in the Gemfile and I want to use the core extensions of this gem in a model, so I have to require 'unitwise/ext' which isn't by default. Should...
View ArticleConfiguring Vagrant CA Certificates
I am experiencing problems executing Vagrant commands behind a corporate proxy server and self-signed CA certificates. I have configured environment variables HTTP_PROXY, HTTPS_PROXY, and HTTP_NO_PROXY...
View ArticleWhy am I getting a 'No such file or directory' error when attempting to run...
there. I am working on a project in a small team, our app is build on the ruby on rails, I am Front End Developer and do all React stuff, but recently we updated version of ruby to the latest one,...
View Articleinstalling ffi failing when bundle install has run
I am trying to run bundle install on my new react native project, however I keep running into this issue. I tried reinstalling xcode command line tools and updated ruby with brew too. No answer in...
View ArticlePrevent property value inspect when exception is thrown
When an exception in thrown for a ruby object, the object's properties are serialized into the exception message.class MyClass def initialize @hash = { user: 'user_name', password:...
View ArticleI am having a Ruby Bundler error in my Rails project regarding Git file size
I even commented out the vendor file and yet it is still giving this error. Is there any way that it can be fixed? Otherwise it is saying that my git files are too large.Here is the error:remote:...
View ArticleShopifyAPI::InventoryLevel.delete deletes but also throws a NoMethodError
I'm using the ShopifyAPI Ruby gem. As part of the gem I can delete the InventoryLevel of a product at a specific location.This works well: ShopifyAPI::InventoryLevel.delete( inventory_item_id:...
View ArticleRuby: Check if string contains substring and nothing else
Users can upload a CSV file to my service. The CSV needs to have two column names and nothing else. One column needs to be "email" and the other "credit" and nothing else can be in those column names,...
View ArticleBundler, when attempting to update or install, will hang forever
When attempting to run bundle install or bundle update, bundler will perpetually hang, and not complete its function. The only time that it will finish is when I specify a gem to update. For...
View ArticleHow to solve "Double free for ptr 0x7f7c33808200" in ruby on rails?
I have a Ruby on Rails API application on macOS Sonoma, x86 intel i7.I can start the server using rails s. When I hit my endpoint, it logs the following:Started POST "/v1/login" for ::1 at 2023-12-13...
View ArticleWhy doesn't this has_many :through collection_check_boxes form input not...
I have a has_many :through association setup in a Rails 7 app.I'm using the ActsAsBookable gem to handle bookings for events. An Event has_many EventExtras that can be added from the booking, and a...
View ArticleHow do I search the gem with specific version and platform
I encountered problem that the sorbet-static:0.5.10346-x86_64-linux couldn't install with either bundle install and gem install sorbet-static:0.5.10346 --platform x86_64-linux in ruby:2.5.1 x86_64...
View Article