Skip to content

Instantly share code, notes, and snippets.

@lukesutton
Created June 15, 2010 03:58
Show Gist options
  • Save lukesutton/438675 to your computer and use it in GitHub Desktop.
Save lukesutton/438675 to your computer and use it in GitHub Desktop.
class Migration
@grants = {}
def self.grant(name, &blk)
if block_given?
proxy = ConfigProxy.new(&blk)
grant = Grant.new(proxy.options)
@grants[name] = grant
else
@grants[name]
end
end
class Grant
def initialize(opts)
end
def up
end
def down
end
end
class ConfigProxy
attr_reader :options
def initialize(&blk)
instance_eval(&blk)
end
def method_missing(method, *opt)
@options ||= {}
@options[method] = opt
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment