Category "ruby"

What is `null false` in mutations graphQL rails?

module Mutations class BaseMutation < GraphQL::Schema::Mutation null false # <---- what is this? end end In a lot of classes, I see this function

Hadamard matrix in Ruby is not unitary although it should be?

Even when trying to define Hadamard matrix in Ruby by using rational numbers (which helps us sometimes to keep good precision) the result is that Hadamard matri

brew\homebrew use ruby api and not its cli api

rather than using the brew through the command line, i would like to use its api in ruby. for instance, rather than executing brew info --json wget in the comma

bin/rails console doesn't start

I'm new to Rails & Ruby in general. I was following this guide and got stuck on step 6.3. my bin/rails console result in error below /home/gaura/.local/shar

ERROR: While executing gem ... (Gem::Exception) OpenSSL is not available

I get this openssl error when trying to install/update any gem, although I have openSSL installed through brew install openssl. This can be frustrating but ther

Facebook Marketing API create Ad Creatives Error

I'm having issues creating Ad Creatives using: gem 'facebookbusiness' Facebook API version 13.0 I have successfully managed to upload Ad Images and to get the

Dynamic table name in Ruby sqlite query based on class name

I have a parent class that looks like this: class Record attr_accessor :id, :url, :votes, :title, :first_name, :last_name, :selfdb def initialize(args

Approximate comparison of 2 Ruby DateTimes

I have 2 DateTimes and I want to check if they're roughly 24 hours apart, plus or minus a small amount, say 5 minutes. Is there a built in way to do this?

I have delete method that doesn't have parameter, how do I test it using rspec 3.0+

I've been struggling to find how to do this. I have some tty-prompt gem to receive inputs from user and need to do rspec testing. But here I'm showing the simpl

How to assign an instance to a variable - .find() / .where() - and access it's values - RUBY on RAILS

account = Account.find(params[:account_id]) account_to_receive = Account.where(number_account: transaction.account_to_transfer) So I am building a bank app I wo

Warnings when upgrading application from Rails 5 to Rails 7

with a recent upgrade to rails 7.0.2 from rails 5.2, when ever i start a rails console or a rails server on dev mode i see these warnings /Users/opensource/.rvm

Rails App Breaks with 404 Error when Last.fm API Call Returns Nothing

I wonder if anyone can help, and if the issue is specific to Last.fm (perhaps not the greatest of APIs). I've built an album search feature into my app that tak

I am trying to create a post in instagram clone in ruby and rails but it throws an error "no implicit conversion of Integer into string"

This is the Post Model class Post < ApplicationRecord mount_uploader :image, ImageUploader scope :active, -> { where active: true } end This is

Set a new value after using regex

I have a string that is equal to stringnum. stringnum = "0007001369920090687073" I need to use regex to grab the first 9 digits after the first 3 zeros. I am u

Remote url failed to load in asciidoctor-epub3

I'm unable to generate/view the image from a remote URL while generating the Mobi. Whereas it works for asciidoctor when converting adoc to HTML Code look some

Whats missing on my Ruby 'Inverse Of' relationship

I know this topic has been addressed, but I have been at this for 2 days and I'm just stuck. I know inverse of does not create a new query, so should I use anot

Ruby : Cannot load such file --ruby2d (LoadError)

I'm new to Ruby,Writing some code to make a game,so using ruby2d library. Got an error while writing some basic code. Help me out Folks. require 'ruby2d' set ba

How to refactor round method with 3 digits

I would like to round float numbers like this : 125.212 = 125.250 125.249 = 125.250 125.268 = 125.250 125.280 = 125.275 125.999 = 126.000 I have do a method, h

Obtain all commits in all branches Using Ruby Rugged

Using the Rugged gem, I want to obtain all commits in all branches, similar to this git command line: $ git log --all Walker requires a branch, so the followin

Library functions in Inspec Test

Team -- I have a ruby library helper in which I have defined multiple functions/methods. How do I reference those in Chef Inspec tests? def interface_name # s