Class: Usable::Scoped

Inherits:
Object
  • Object
show all
Defined in:
lib/usable/scoped.rb

Defined Under Namespace

Modules: Configurable

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



12
13
14
# File 'lib/usable/scoped.rb', line 12

def self.extended(base)
  base.extend Configurable
end

Instance Method Details

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



16
17
18
19
20
21
22
23
# File 'lib/usable/scoped.rb', line 16

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