Sha256: 4bc502d58f7da8bda9fdd60e6d117d226390c50fb85150907f69c1c10373bdca

Contents?: true

Size: 625 Bytes

Versions: 85

Compression:

Stored size: 625 Bytes

Contents

module PactBroker
  module Config
    class SpaceDelimitedStringList < Array

      def initialize list
        super(list)
      end

      def self.parse(string)
        array = (string || '').split(' ').collect do | word |
          if word[0] == '/' and word[-1] == '/'
            Regexp.new(word[1..-2])
          else
            word
          end
        end
        SpaceDelimitedStringList.new(array)
      end

      def to_s
        collect do | word |
          if word.is_a?(Regexp)
            "/#{word.source}/"
          else
            word
          end
        end.join(' ')
      end
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
pact_broker-2.23.3 lib/pact_broker/config/space_delimited_string_list.rb
pact_broker-2.23.2 lib/pact_broker/config/space_delimited_string_list.rb
pact_broker-2.23.1 lib/pact_broker/config/space_delimited_string_list.rb
pact_broker-2.23.0 lib/pact_broker/config/space_delimited_string_list.rb
pact_broker-2.22.0 lib/pact_broker/config/space_delimited_string_list.rb