/explore

Click through on any links that interest you or select the planets on the right to continue exploring the Outer Web.
You are here

www.railstips.org
| | thepugautomatic.com

I recently discovered the Ruby Module Builder pattern. It lets you pass in arguments to dynamically generate a module at include time: class Greeter < Module def initialize(name)...
5.2 parsecs

Travel
| |
| | thomascountz.com

Adding Functionality to Client Classes The first step in tackling this problem is to add functionality to a model class. If we have a class Book, we want to add a class method Book.find , and some instance methods book#title, book#author, and book#isbn, without needed to explicitly write them, like we did in the original spike. A Note on Mix-Ins & Inheritance When you want to create a model with ActiveRecord, you have to inherit from the Base module: class Book < ActiveRecord::Base; end There are endless debates about composition v. inheritance, and, from my perspective, they all mostly lean towards composition, but what about using mix-ins versus using string inheritance? In Ruby, inheriting and including a module both add a new entity in the method look-up...
2.9 parsecs

Travel
| |
| | blog.jayfields.com

Module.include(module, ..) is commonly used to mix modules into classes and other modules. When a module is included the constants, methods...
2.8 parsecs

Travel
| |
| | blog.hmpl-lang.dev

Hello! This is not clickbait. I thought for a long time about what to call this article, but it is hard to convey in words what is felt. Therefore, I wrote simply as I felt. For a long year we have been supplementing the template language, but the range of...
16.4 parsecs

Travel
|