Created
April 12, 2011 03:00
-
-
Save zacclark/914841 to your computer and use it in GitHub Desktop.
First attempt at a simplified middleground record for exporting.
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
class FlatPerson | |
def initialize(person) | |
raise TypeMismatch unless person.class == Person | |
person.attribute_names.each do |attr| | |
eval("@#{attr} = person.#{attr}") | |
end | |
end | |
def method_missing(arg) | |
if eval("@#{arg}") | |
eval("@#{arg}") | |
end | |
end | |
end | |
class TypeMismatch < StandardError; end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment