Skip to content

Instantly share code, notes, and snippets.

@mlangenberg
Created August 28, 2008 08:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mlangenberg/7672 to your computer and use it in GitHub Desktop.
Save mlangenberg/7672 to your computer and use it in GitHub Desktop.
module Lib
def self.my_attr_reader(klass, attr)
eval %{
class #{klass.to_s}
def #{attr.to_s}
'red'
end
end
}
end
end
class Car
Lib::my_attr_reader(self, 'color')
end
c = Car.new
c.color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment