Giter Club home page Giter Club logo

Comments (1)

mtasaka avatar mtasaka commented on June 24, 2024

This is because of "announced" Strcut behavior changed in ruby3.2 that "keyword_init" being true by default:

So passing keyword argument to Struct behaves differently in ruby3.2.

ruby3.1 actually already warns about this:

[tasaka1@localhost ~]$ ruby --version
ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
[tasaka1@localhost ~]$ ruby -e "Struct.new(:registers).new(page: { 'toc' => false })"
-e:1: warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3.2. Please use a Hash literal like .new({k: v}) instead of .new(k: v).
[tasaka1@localhost ~]$ ruby -e "Struct.new(:registers, keyword_init: true).new(page: { 'toc' => false })"
-e:1:in `initialize': unknown keywords: page (ArgumentError)
	from -e:1:in `new'
	from -e:1:in `<main>'

from jekyll-toc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.