Sha256: 3b7a47e5be6d1b649b770709467b20dbe67821ba69e5be933a916601b105204d

Contents?: true

Size: 800 Bytes

Versions: 5

Compression:

Stored size: 800 Bytes

Contents

module Rake::Funnel::Support::ArgumentMapper::Styles
  class NUnit
    attr_reader :prefix, :separator, :value_separator

    def initialize
      @prefix = Rake::Win32.windows? ? '/' : '-'
      @separator = '='
      @value_separator = ':'
    end

    def generate_from(model)
      model.map { |switch|
        switch.values.flatten.map { |value|
          top_level(switch) + nested(value)
        }
      }.flatten(1)
    end

    private
    def top_level(switch)
      [prefix, switch.switch]
    end

    def nested(value)
      res = []
      res << separator unless value.key.nil? && value.value.nil?
      res << value.key
      res << value_separator unless value.key.nil? || value.value.nil?
      res << value.value
      res.compact
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre lib/rake/funnel/support/argument_mapper/styles/nunit.rb
rake-funnel-0.3.1.pre lib/rake/funnel/support/argument_mapper/styles/nunit.rb
rake-funnel-0.3.0.pre lib/rake/funnel/support/argument_mapper/styles/nunit.rb
rake-funnel-0.2.0.pre lib/rake/funnel/support/argument_mapper/styles/nunit.rb
rake-funnel-0.1.0.pre lib/rake/funnel/support/argument_mapper/styles/nunit.rb