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

Instance Method Summary collapse

Instance Attribute Details

#configurationObject

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

Yields:



20
21
22
23
# File 'lib/ruby_api_pack_core/configurable.rb', line 20

def configure
  self.configuration ||= configuration_class.new
  yield(configuration)
end