Created
November 23, 2008 16:17
-
-
Save gerhard/28147 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apeiros_: send accepts a method name. for x.foo = "bar", the method name is 'foo=' | |
| apeiros_: oh boy. macgerhard, x.send(method, *args) | |
| apeiros_: your method is 'attrname=' | |
| apeiros_: your args is the value you want to assign | |
| apeiros_: and there IS NO = after send. makes no sense. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> a.attributes | |
| => {"address1"=>"Address1", "updated_at"=>nil, "address2"=>nil, "postcode"=>nil, "county"=>nil, "archived"=>false, "town"=>nil, "main"=>false, "created_at"=>nil} | |
| >> a.attributes.each_pair { |attribute, value| a[attribute] = value.upcase if value.is_a?(String) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment