Sha256: 11415367b274ad626e77aeeaabe7ceef1f1f9dad03c717a015e1200e73421ed8

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

module PactBroker
  module Client
    module CLI
      class VersionSelectorOptionsParser
        def self.call options
          versions = []
          last_flag = nil
          options.each do | option |
            case option
            when "--name", "-n"
              versions << {}
            when /^\-/
              nil
            else
              case last_flag
              when "--name", "-n"
                versions.last[:name] = option
              when "--version", "-a"
                versions.last[:version] = option
              end
            end
            last_flag = option if option.start_with?("-")
          end
          versions
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pact_broker-client-1.8.0 lib/pact_broker/client/cli/version_selector_options_parser.rb
pact_broker-client-1.7.0 lib/pact_broker/client/cli/version_selector_options_parser.rb