ruby

Blocks, Procs, and Lambdas for functional programming

Ruby's closures—blocks, procs, lambdas—enable functional programming patterns. Blocks are anonymous code chunks passed to methods. Procs are objects wrapping blocks, callable with call. Lambdas are stricter procs—check argument count and return differ

Dry-rb gems for functional programming patterns

Dry-rb provides functional programming tools for Ruby. dry-validation creates complex validation schemas with type checking. dry-types defines strict types—coercion, constraints, sum types. I use dry-struct for immutable data structures with typed att

Rails engines for modular applications

Rails engines are miniature Rails applications within applications. I use engines for extracting reusable functionality—authentication, billing, admin panels. Engines have their own models, controllers, views, routes, migrations. Mountable engines are

Pundit for authorization and policy objects

Pundit provides simple, object-oriented authorization. Policies encapsulate authorization rules in plain Ruby classes. Each model gets a policy class defining who can perform actions. I use Pundit for fine-grained permissions—different users see diffe

Query objects for complex database queries

Query objects encapsulate complex database queries in reusable, testable classes. I use query objects when scopes become too complex or require parameters. Query objects compose smaller scopes, handle conditionals, and apply filtering logic. They're i

Decorator pattern with Draper for view logic

Draper decorators encapsulate view-specific logic, keeping models clean. Decorators wrap models, adding presentation methods without polluting domain logic. I use decorators for formatting, conditional rendering, helper delegation. Decorators access h

Concurrent Ruby with Ractors and Async

Ruby 3+ introduces Ractors for true parallelism without GIL limitations. Ractors are isolated actors—no shared mutable state. I use Ractors for CPU-intensive parallel processing. Messages pass between Ractors via send and receive. Async gem provides s

GraphQL APIs with graphql-ruby gem

GraphQL enables clients to request exactly the data they need. The graphql-ruby gem implements GraphQL servers in Rails. Types define data structures—ObjectTypes for models, InputTypes for mutations. Queries fetch data; mutations modify data. Resolver

Performance profiling with rack-mini-profiler and tools

rack-mini-profiler reveals performance bottlenecks in Rails apps. It displays database queries, rendering time, memory allocation on every page. I use Flamegraphs to visualize where time is spent. Memory profiling identifies allocation hotspots. Query

Background jobs with Sidekiq and ActiveJob

Sidekiq processes background jobs asynchronously using Redis and multi-threading. ActiveJob provides framework-agnostic interface—I use it for portability between job processors. Jobs handle emails, data processing, API calls, report generation. perfo

Advanced RSpec testing with shared examples

RSpec provides powerful testing tools for behavior-driven development. Shared examples reduce duplication across similar specs—I extract common behavior into reusable examples. Contexts organize tests by different scenarios. Let blocks lazily evaluate

Hotwire Turbo for SPA-like user experiences

Hotwire Turbo delivers SPA speed without JavaScript complexity. Turbo Drive accelerates navigation by replacing page body without full reload. Turbo Frames update page sections independently—click a frame link, only that frame refreshes. Turbo Streams