Module: Usable

Defined in:
lib/usable/scoped.rb,
lib/usable.rb,
lib/usable/version.rb

Overview

Note:

UNTESTED and not included by default

Defined Under Namespace

Classes: Config, Scoped

Constant Summary collapse

VERSION =
"0.1.0".freeze

Instance Method Summary collapse

Instance Method Details

#configObject



5
6
7
# File 'lib/usable.rb', line 5

def config
  @config ||= Config.new
end

#use(mod, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/usable.rb', line 9

def use(mod, options = {})
  send :include, mod unless self < mod
  if block_given?
    yield config
  else
    options.each { |k, v| config.public_send "#{k}=", v }
  end
end