Module: Confucious::ClassMethods

Defined in:
lib/confucious.rb

Instance Method Summary collapse

Instance Method Details

#configObject



27
28
29
# File 'lib/confucious.rb', line 27

def config
  @config ||= Confucious::Config.new
end

#configuration(&block) ⇒ Object



23
24
25
# File 'lib/confucious.rb', line 23

def configuration(&block)
  Confucious::Config.instance_eval(&block) if block_given?
end

#configure(opts = {}) {|mash| ... } ⇒ Object

This allows us to do cool things like set our own configuration in a block

Usage:

[Module].configure do

end

Yields:

  • (mash)


16
17
18
19
20
21
# File 'lib/confucious.rb', line 16

def configure(opts={}, &block)
  @config = nil # reset!
  mash = Hashie::Mash.new(opts)
  yield mash if block_given?
  Confucious::Config.defaults.merge!(mash)
end