Created
August 24, 2015 20:55
-
-
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.
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
# 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