With a block eval.
This example is taken from Sequel::Model, which creates accessor methods for the columns it finds when introspecting the database, which may contain spaces or other characters not valid in ruby literals.