[Nitro] [FEATURE] alias method for boolean attributes

transfire at gmail.com transfire at gmail.com
Thu Mar 15 10:32:50 EDT 2007



On Mar 14, 7:54 pm, "Antoniolo" <antoni... at gmail.com> wrote:
> It's just a silly feature ... but worthwhile.
>
> class BankAccount
>   attr_accessor :blocked, TrueClass
> end
>
> acc = BankAccount[1]
> acc.blocked # => true
> acc.blocked? # => true

Interesting, but I'm not so sure about this approach. I'll have to
look at how this was implemented. Normally one would use

  attr_tester :blocked

or equiv.

  attr_query :blocked

(Can't say I've ever loved either of those names however)

T.



More information about the Nitro-general mailing list