#27 new
bahuvrihi

Nested config applies defaults even when specified

Reported by bahuvrihi | July 14th, 2009 @ 08:26 PM

  • nested configs initialize with defaults and then are reconfigured, evidently. this means incorrect defaults cannot be used: Given this task:
  require 'tap/task'

  # Request::task
  class Request < Tap::Task
    nest :a do
      config :b, nil, &c.integer
    end
  
    def process
      puts a.b
    end
  end

This will result

% rap request --a:b 1
expected [Integer] but was: nil

Normally if a switch is specified on the command line, the default will not be applied. This allows the rare case where you want an invalid default. Evidently nested configs initialize with defaults and then are reconfigured, and this should not be the case.

No comments found

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Class configurations that map to the command line.

People watching this ticket

Pages