Sha256: 81cc7266cddab2d05ae7f197675a003a581eb67fa6270ffc709fc5433e870f15

Contents?: true

Size: 804 Bytes

Versions: 14

Compression:

Stored size: 804 Bytes

Contents

#!/usr/bin/env ruby
$: << File.dirname(__FILE__)+'/../lib'
require 'configliere'
Settings.use :config_block

Settings.define :passenger
Settings.define :dest_time, :type => DateTime
Settings :passenger => 'einstein', :dest_time => '1955-11-05'

Settings.finally do |c|
  p ['(2) takes the settings object as arg', self, c[:passenger], c.passenger]
  # Einstein the dog should only be sent one minute into the future.
  c.dest_time = (Time.now + 60) if c.passenger == 'einstein'
end

Settings.finally{ p ['(3) note that blocks go in order'] }

Settings.define :mc_fly, :default => 'wuss',
  :finally => lambda{ p ['(4) here is a block in the define'] ; Settings.mc_fly = 'badass' }

p ["(1) :finally blocks are called when you invoke resolve!"]
Settings.resolve!
p ['(5) here are the settings', Settings]

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
configliere-0.4.22 examples/config_block_script.rb
configliere-0.4.18 examples/config_block_script.rb
configliere-0.4.17 examples/config_block_script.rb
configliere-0.4.16 examples/config_block_script.rb
configliere-0.4.14 examples/config_block_script.rb
configliere-0.4.13 examples/config_block_script.rb
configliere-0.4.12 examples/config_block_script.rb
configliere-0.4.11 examples/config_block_script.rb
configliere-0.4.10 examples/config_block_script.rb
configliere-0.4.8 examples/config_block_script.rb
configliere-0.4.7 examples/config_block_script.rb
configliere-0.4.6 examples/config_block_script.rb
configliere-0.4.5 examples/config_block_script.rb
configliere-0.4.4 examples/config_block_script.rb