Module: RubyApiPackCore::Configurable
- Defined in:
- lib/ruby_api_pack_core/configurable.rb
Overview
Extend a top-level gem module with this to get the standard
MyGem.configure { |c| ... } / MyGem.configuration singleton pattern.
The extending module must implement .configuration_class, returning the
Configuration class to instantiate, e.g.:
module MyGem
extend RubyApiPackCore::Configurable
def self.configuration_class
Configuration
end
end
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Returns the value of attribute configuration.
Instance Method Summary collapse
Instance Attribute Details
#configuration ⇒ Object
Returns the value of attribute configuration.
18 19 20 |
# File 'lib/ruby_api_pack_core/configurable.rb', line 18 def configuration @configuration end |
Instance Method Details
#configure {|configuration| ... } ⇒ Object
20 21 22 23 |
# File 'lib/ruby_api_pack_core/configurable.rb', line 20 def configure self.configuration ||= configuration_class.new yield(configuration) end |