Skip to content

Instantly share code, notes, and snippets.

@remi
Created December 6, 2012 18:38
Show Gist options
  • Save remi/4226914 to your computer and use it in GitHub Desktop.
Save remi/4226914 to your computer and use it in GitHub Desktop.
Gathering options using a block
# config/initializers/tumbz_init.rb
Tumbz.configure do |config|
config.access_key = "foo"
config.access_secret = "bar"
end
# lib/tumbz.rb
module Tumbz
def self.configure
@options = OpenStruct.new
yield(@options)
# @options.access_key # => "foo"
# @options.access_secret # => "bar"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment