One advantage is the communication of the goal, between the code (and the original author) and those who discuss the code later. (And the mechanics of parameter resolution.)
acts_as_csv points to an aspect of RubyCsv behavior.
include ActsAsCsv less declarative. Does it provide additional methods, does it significantly change the functionality of the base class, or both, or ...? You will not know until you read the documents. You may not know until you read the documents for acts_as_csv , but this is more communicative.
This is the difference between "this is what I am" and "this is what I can." Don't get into a concrete example: consider the mechanics of what is being done and how.
This mechanism is one of the reasons why Ruby code may look like a problem that it is trying to solve, and not just Ruby. This is one way of implementing micro-DSL that helps make Ruby more expressive than it.
source share