Created
June 15, 2010 03:58
-
-
Save lukesutton/438675 to your computer and use it in GitHub Desktop.
This file contains 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 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