Ruby 每周问题 703:2024 年 5 月 16 日

  • Ruby 3.4 Preview 1 Released: The first preview of Ruby 3.4 is out. It's fun to play with new features and reminds of Christmas. It's a preview, not for production use (except for Shopify), and there's a key change in string literals behavior that may break some dependencies.
  • Free eBook: Advanced Database Programming with Rails and Postgres: Learn about subqueries, materialized views, and custom data types in Postgres and Rails. With realistic examples translated into SQL and Rails code, and source code provided.
  • Other Ruby-related News:

    • A DoS vulnerability has been found in REXML, so it's encouraged to upgrade ASAP.
    • Rails core member Eileen Uchitele's Tropical.rb keynote is available on YouTube, digging into higher level ideas about Rails. 17 other talks from Tropical.rb are also available.
    • Near NYC, Obie Fernandez is speaking at NYC.rb next month about Ruby's role in the growing world of AI and has written about it recently.
    • The Ruby core team is working on the idea of making garbage collector routines easier to replace or enhance.
    • Rails 8 adds Kamal by default.
  • GitHub's dependabot-core is Now Open Source: Dependabot is a tool GitHub uses to monitor project dependencies and create automated PRs. Now dependabot-core is open source, mostly written in Ruby.
  • Code & Tools:

    • Pygments.rb 3.0: Ruby wrapper for Pygments syntax highlighter.
    • Humanize 3.1: Converts numbers to text in 13 languages.
    • Business Class 1.7: Commercial SaaS starter kit for Rails for Rails 8.
    • Cyperful 0.2: Interactive system testing UI for Capybara with RSpec support.
    • GraphqlDevise 1.5: GraphQL interface on top of devise_token_auth.
    • Reline 0.5.7: Better, compatible readline library.
    • Meilisearch Rails 0.13: Meilisearch integration for Rails.
    • rspec-sidekiq 5.0: Simple testing of Sidekiq jobs.
  • Quick tips:

    • On Twitter, Dr Nic Williams shared a tip to make systems like ChatGPT return better code by being specific in system prompts.
    • To create a hash with keys as unique values and values as the number of times they appear in an array, use array.tally since Ruby 2.7, or similar code like array.each_with_object(Hash.new(0)) { |i, h| h[i] += 1 } or hash = Hash.new(0); array.each { |i| hash[i] += 1 }.
    • Skim Ruby's docs from time to time to find useful shortcuts and things you may have forgotten in daily work.
阅读 16
0 条评论