Skip to content

Instantly share code, notes, and snippets.

@timruffles
Created March 6, 2012 11:26
Show Gist options
  • Select an option

  • Save timruffles/1985780 to your computer and use it in GitHub Desktop.

Select an option

Save timruffles/1985780 to your computer and use it in GitHub Desktop.
Config via override
class Conf
class << self
class << self
def if_undef method, &block
define_method method, &block unless Conf.respond_to? method
end
end
if_undef :foo do
"foo"
end
def bar
"original"
end
if_undef :bar do
"new"
end
end
end
puts Conf.foo
puts Conf.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment