← 返回
内容创作 中文

Ruby

Write expressive Ruby with blocks, metaprogramming, and idiomatic patterns.
使用块、元编程和惯用模式编写富于表现力的 Ruby 代码。
ivangdavila
内容创作 clawhub v1.0.1 1 版本 99933.1 Key: 无需
★ 2
Stars
📥 1,454
下载
💾 97
安装
1
版本
#latest

概述

Quick Reference

TopicFile
-------------
Mutable strings, object equalityobjects.md
Proc vs lambda, return behaviorblocks.md
Visibility, method_missingmethods.md
Array/hash mutation trapscollections.md
define_method, eval trapsmetaprogramming.md
ActiveRecord, N+1, callbacksrails.md

Critical Rules

  • Strings are mutable — s = "hi"; s << "!"; t = s means t also has "!"
  • == vs equal? vs eql?== value, equal? identity, eql? hash equality
  • Default hash value is shared — Hash.new([]) shares same array, use block form
  • return in proc returns from enclosing method — use lambda for local return
  • Block variable shadows outer scope — x = 1; [2].each { |x| }; x is still 1 (3.0+)
  • method_missing without respond_to_missing? — breaks respond_to? checks
  • private in Ruby is per-object — self.private_method fails, implicit receiver works
  • ||= doesn't work for false/nil distinction — false ||= true replaces false
  • Frozen string literals — # frozen_string_literal: true makes strings immutable
  • Symbol#to_proc&:method_name only works with no-argument methods
  • rescue => e without type — catches StandardError, not Exception
  • ensure always runs — even after return, use for cleanup

版本历史

共 1 个版本

  • v1.0.1 当前
    2026-03-29 00:42 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

productivity

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 440 📥 147,916
content-creation

AdMapix

fly0pants
广告情报与应用数据分析助手,支持搜索广告素材、分析应用排名、下载量、收入及市场洞察,用于广告素材和竞品分析。
★ 295 📥 136,546
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,362 📥 318,822