module ConfigX

Constants

CONFIG_NAMESPACE
VERSION

Public Instance Methods

configurable(type, &block) click to toggle source
# File lib/config_x.rb, line 9
def configurable(type, &block)
  store_maps = {}
  config_interface = Module.new
  owner_interface = Module.new

  store_maps[type] = Interface::Builder.new(config_interface, owner_interface).build(&block)

  interfaces = [
    Interface::Base,
    config_interface,
    owner_interface
  ]

  inclusion_method = case type
  when :instance
    :include
  when :class
    :extend
  else
    raise StandardError, "Type #{type} not supported in configurable. Only :instance and :class"
  end

  interfaces.each { |interface| send inclusion_method, interface }
  instance_variable_set(:@store_maps, store_maps)
end