ConfigBlock lets you use pure ruby to change and define settings. Call #finally with a block of code to be run after all other settings are in place.
Settings.finally{|c| c.your_mom[:college] = 'went' unless (! c.mom_jokes_allowed) }
Define a block of code to run after all other settings are in place.
@param &block each finally block is called once, in the order it was
defined, when the resolve! method is invoked. +config_block+ resolution is guaranteed to run last in the resolve chain, right before validation.
@example
Settings.finally do |c| c.dest_time = (Time.now + 60) if c.username == 'einstein' # you can use hash syntax too c[:dest_time] = (Time.now + 60) if c[:username] == 'einstein' end # ... # after rest of setup: Settings.resolve!
# File lib/configliere/config_block.rb, line 27 def finally &block self.final_blocks << block if block end
Processing to reconcile all options
The resolve! for config_block is made to run last of all in the resolve! chain, and runs each finally block in the order it was defined.
# File lib/configliere/config_block.rb, line 35 def resolve! super resolve_finally_blocks! self end
Generated with the Darkfish Rdoc Generator 2.