[Facebooker-talk] view problem
kevin lochner
klochner at gmail.com
Fri Jan 23 18:06:41 EST 2009
How about setting to nil if value isn't a hash. The object is
hash_settable, and it doesn't
seem to make sense to assign it an object of arbitrary class (string)
if it's not given a hash
from which to populate:
def hash_settable_writer(symbol, klass)
define_method("#{symbol}=") do |value|
instance_variable_set("@#{symbol}", value.kind_of?(Hash) ?
klass.from_hash(value) : nil)
end
end
On Jan 23, 2009, at 5:52 PM, kevin lochner wrote:
> def hash_settable_writer(symbol, klass)
> define_method("#{symbol}=") do |value|
> instance_variable_set("@#{symbol}", value.kind_of?(Hash) ?
> klass.from_hash(value) : value)
> end
> end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/facebooker-talk/attachments/20090123/efd7218e/attachment.html>
More information about the Facebooker-talk
mailing list