< :the previous in number
^ :the list in numerical order
> :the next in number
P :the previous aricle (the previous thread)
N :the next (in thread)
|<:the previous thread
>|:the next thread
^ :the parent (reply-to)
_:the child (an article replying to this)
>:the elder article having the same parent
<:the youger article having the same parent
---:split window and show thread lists
| :split window (vertically) and show thread lists
~ :close the thread frame
.:the index
..:the index of indices
Begin forwarded message:
> From: "Phil Tomson" <philtomson / gmail.com>
> Date: February 18, 2006 6:46:02 PM CST
> To: submission / rubyquiz.com
> Subject: [SOLUTION] Quiz #67 metakoans.rb
>
> James,
>
> Fun quiz!
>
> I don't subscribe to ruby-talk and the c.l.r bridge has been a bit
> flakey (I didn't see your original post for this quiz on c.l.r, only
> the responses) and I'll be out all day tomorrow.... so I include my
> solution below.
>
> Phil
>
> #knowledge.rb
> class Module
> def attribute(h_or_s, &b)
> if h_or_s.class == Hash
> str, val = h_or_s.keys[0].to_s, h_or_s.values[0]
> elsif h_or_s.class == String
> str, val = h_or_s.to_s, 0
> end
> if block_given?
> val = :init_block
> define_method(val, &b)
> end
> class_eval "def #{str}; @#{str}||=#{val} ; end"
> class_eval "def #{str}=(val); @#{str}=val; end"
> class_eval "def #{str}?; @#{str} ? true : false ; end"
> end
> end