Sha256: a0bb44d2f8a1553460e0fc77500d7b220726bb25e53bb37aca595a3f0ecab079

Contents?: true

Size: 789 Bytes

Versions: 13

Compression:

Stored size: 789 Bytes

Contents

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

class Wolfman
  attr_accessor :config
  def config
    @config || = Configliere::Param.new.use(:commandline).defaults({
      :moon    => 'full',
      :nards   => true,
      })
  end
end

teen_wolf = Wolfman.new

teen_wolf.config.description = 'Run this with commandline args: Wolfman uses them, Settings does not'
teen_wolf.config.defaults(:give_me => 'keg of beer')

teen_wolf.config.resolve!
Settings.resolve!

# run this with ./examples/independent_config.rb --hi=there :
puts "If you run this with #{$0} --hi=there, you should expect:"
puts '{:moon=>"full", :nards=>true, :give_me=>"keg of beer", :hi=>"there"}'
p teen_wolf.config

puts 'the Settings hash should be empty:'
p Settings         #=> {}

Version data entries

13 entries across 13 versions & 1 rubygems

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