# Fwd: Quiz #67 metakoans.rb

**URL:** <https://www.ruby-forum.com/t/fwd-quiz-67-metakoans-rb/70522>\
**Category:** Ruby\
**Created:** [February 19, 2006, 5:56pm UTC](https://www.ruby-forum.com/t/fwd-quiz-67-metakoans-rb/70522 "2006-02-19T17:56:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbazzarrakk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/47e85d/32.png) [@bbazzarrakk](https://www.ruby-forum.com/u/bbazzarrakk)\
**Post date:** [February 19, 2006, 5:56pm UTC](https://www.ruby-forum.com/t/fwd-quiz-67-metakoans-rb/70522/1 "2006-02-19T17:56:25Z")

</div>

Begin forwarded message:

---

<div class="post-metadata">

**Author:** ![bbazzarrakk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/47e85d/32.png) [@bbazzarrakk](https://www.ruby-forum.com/u/bbazzarrakk)\
**Post date:** [February 19, 2006, 11:54pm UTC](https://www.ruby-forum.com/t/fwd-quiz-67-metakoans-rb/70522/2 "2006-02-19T23:54:20Z")

</div>

The only interesting thing I have to say here that hasn’t been said is  
that this test seems like a variation of Pair Programming, where one  
person writes the tests and the other writes the code. No better way  
to ensure you only write code to make a failing test pass than to know  
nothing about the problem space except the most recent test failure.

class Object  
def attribute(arg, &block)  
name = (arg.class == Hash ? arg.keys[0] : arg)  
define\_method(name) do  
first\_access\_action(arg,&block) unless instance\_eval("defined? "

- “@” + name)  
instance\_variable\_get “@” + name  
end  
attr\_writer name  
alias\_method name+"?",name  
end
