Last active
December 23, 2015 12:19
-
-
Save vlado/6634732 to your computer and use it in GitHub Desktop.
How to write config block for gems. Inspired by http://rarlindseysmash.com/posts/config-and-generators-in-gems
This file contains hidden or 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
module Jem | |
class << self | |
attr_accessor :configuration | |
end | |
def self.configure | |
self.configuration ||= Configuration.new | |
yield(configuration) | |
end | |
class Configuration | |
attr_accessor :option | |
def initialize | |
@option = 'default_option' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment