{"enrichment":{"faq":[{"a":"Ruby blocks are anonymous code chunks passed to methods. The yield keyword executes the block within a method's context. Ruby uses blocks extensively\u2014iterators like `each` and `map` accept blocks. Blocks can access the method's local variables and return values to the caller. Understanding blocks is fundamental to Ruby's functional programming style and idiomatic code patterns.","q":"How do blocks and yield work in Ruby?"},{"a":"Ruby metaprogramming lets you write code that writes code. method_missing intercepts calls to undefined methods, enabling dynamic method handling. define_method creates methods at runtime. Ruby also supports refinements for scoped monkey patching and symbol-to-proc conversion for compact functional syntax. These techniques power Rails' elegant DSLs and ActiveRecord's dynamic finders.","q":"What are Ruby's metaprogramming techniques like method_missing?"},{"a":"Ruby lambdas and procs are both callable objects, but differ in strictness and return behavior. Lambdas enforce argument count and return to their enclosing method; procs are lenient with arguments and return from the enclosing method. Lambdas are stricter and safer for most use cases. Both support closures and can be passed as block arguments using the & operator.","q":"What's the difference between Ruby lambdas vs procs?"},{"a":"Ruby classes inherit from a single parent (default: Object). Modules provide mixins\u2014reusable behavior included into classes. Multiple modules can be mixed into one class, enabling composition. Inheritance chains methods vertically; modules add methods horizontally. Ruby's method lookup follows the inheritance chain, then included modules in reverse order. This design avoids multiple inheritance complexity while supporting flexible code reuse.","q":"How do Ruby classes, modules, and inheritance work together?"},{"a":"RSpec is Ruby's dominant testing framework using a behavior-driven development (BDD) syntax. Tests read like specifications: `describe`, `context`, and `it` blocks structure tests. Matchers like `expect(value).to eq(expected)` assert outcomes. RSpec supports mocking, stubbing, and fixtures. Combined with proper error handling and exception testing, RSpec enables comprehensive test coverage for Ruby applications.","q":"What testing approach does Ruby use with RSpec?"},{"a":"Ruby on Rails relies on gems\u2014packaged libraries\u2014for functionality. Bundler manages gem dependencies via a Gemfile, resolving version conflicts and locking versions in Gemfile.lock. Rails itself is a gem providing MVC structure, ActiveRecord ORM, and routing. Bundler ensures consistent environments across development, testing, and production. Understanding gem management is essential for Rails backend development and following Ruby on Rails best practices.","q":"How do Rails gems and Bundler manage Ruby dependencies?"}],"shadow_tags":["dynamic-code-generation","functional-programming","object-oriented-design","concurrent-execution","collection-operations","web-framework","testing-framework","exception-patterns","code-introspection","async-programming"],"summary_rewrite":"This skill teaches core Ruby patterns including classes, modules, inheritance, and mixins alongside functional programming with blocks, procs, and lambdas. It covers enumerable operations, lazy evaluation, and metaprogramming techniques like method_missing and dynamic method definition, plus error handling strategies and RSpec testing."},"files":[{"bytes":10629,"path":"programming-languages/ruby/SKILL.md","sha256":"5f3189c52c9e3714aa4f7e28c2e50d052e030549bb527432e80d7c1b2185aa3d","url":"https://skillfed.io/files/miles990/claude-software-skills/ruby/1cf27be4/SKILL.md"}],"id":"miles990/claude-software-skills/ruby","links":{"html":"https://skillfed.io/miles990/claude-software-skills/ruby","md":"https://skillfed.io/miles990/claude-software-skills/ruby.md","repo":"https://github.com/miles990/claude-software-skills"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":5,"language":"TypeScript","last_updated":"2026-01-20","license":"MIT","name":"ruby","publisher":"miles990","stars":19},"relations":{"similar":[{"id":"geoffjay/claude-plugins/ruby-patterns"},{"id":"softspark/ai-toolkit/ruby-patterns"},{"id":"majesticlabs-dev/majestic-marketplace/gem-builder"},{"id":"personamanagmentlayer/pcl/ruby-expert"},{"id":"el-feo/ai-context/ruby"},{"id":"ratacat/claude-skills/andrew-kane-gem-writer"},{"id":"davekilleen/Dex/andrew-kane-gem-writer"},{"id":"softspark/ai-toolkit/ruby-rules"},{"id":"irahardianto/awesome-agv/ruby-idioms"},{"id":"geoffjay/claude-plugins/rack-middleware"}]},"slug":{"owner":"miles990","repo":"claude-software-skills","skill":"ruby"},"version":"1cf27be4"}
