Skip to content

Instantly share code, notes, and snippets.

@0x5d
Created August 24, 2015 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0x5d/56f207f489ca945b30ae to your computer and use it in GitHub Desktop.
Save 0x5d/56f207f489ca945b30ae to your computer and use it in GitHub Desktop.
The updated version of the class retrieving AwesomeGem's configuration, with the event implementation.
# OtherModule has the methods do_stuff_with and do_magic,
# which are like, super important, ok?
require 'other_module'
module AwesomeGem
class AwesomeClass
include OtherModule
# Pass our method calls on a block, so they're called
# after the configuration has taken place.
AwesomeGem.on_configure do
do_stuff_with AwesomeGem.configuration.awesome_string
do_magic if AwesomeGem.configuration.do_magic?
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment