Skip to content

Instantly share code, notes, and snippets.

@genki
Created February 1, 2009 11:27
Show Gist options
  • Save genki/55852 to your computer and use it in GitHub Desktop.
Save genki/55852 to your computer and use it in GitHub Desktop.
>> class DataMapper::Property;include Extlib::Hook;before(:typecast){|v| @before_typecast=v};attr :before_typecast end
=> nil
>> a = User.new
=> #<User activated_at=nil activation_code=nil id=nil login=nil name=nil email=nil timezone=nil crypted_password=nil salt=nil>
>> a.id = "hello"
=> "hello"
>> a.id
=> nil
>> a.send(:properties)[:id]
=> #<Property:User:id>
>> a.send(:properties)[:id].before_typecast
=> "hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment