Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Class configuration using method_missing
module Awesome
@config = {}
def self.configure
yield(self)
end
def self.method_missing method, *args, &block
if method.to_s[-1] == '='
@config[method[0..-2].to_sym] = args.first
else
@config[method]
end
end
end
Awesome.configure do |a|
a.magic_number = 3
end
puts Awesome.magic_number
# => 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.