Sha256: bf6db52ef593f948586aa9c5801400a3f55318961274570d9589a47ef1174f2d

Contents?: true

Size: 650 Bytes

Versions: 4

Compression:

Stored size: 650 Bytes

Contents

module RBS
  module Test
    module SetupHelper
      class InvalidSampleSizeError < StandardError
        attr_reader :string
        
        def initialize(string)
          @string = string
          super("Sample size should be a positive integer: `#{string}`")
        end
      end
      
      DEFAULT_SAMPLE_SIZE = 100
      
      def get_sample_size(string)
        case string
        when ""
          DEFAULT_SAMPLE_SIZE
        when 'ALL'
          nil
        else
          int_size = string.to_i
          raise InvalidSampleSizeError.new(string) unless int_size.positive?
          int_size
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbs-0.10.0 lib/rbs/test/setup_helper.rb
rbs-0.9.1 lib/rbs/test/setup_helper.rb
rbs-0.9.0 lib/rbs/test/setup_helper.rb
rbs-0.8.0 lib/rbs/test/setup_helper.rb