Sha256: 5de05b455de830d0a90a539553c53eea8c5425416be565c18a20b950e24f3822

Contents?: true

Size: 382 Bytes

Versions: 10

Compression:

Stored size: 382 Bytes

Contents

require 'flipper/typecast'

module Flipper
  module Types
    class Percentage < Type
      def initialize(value)
        value = Typecast.to_number(value)

        if value < 0 || value > 100
          raise ArgumentError,
                "value must be a positive number less than or equal to 100, but was #{value}"
        end

        @value = value
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.3.2 lib/flipper/types/percentage.rb
flipper-1.3.1 lib/flipper/types/percentage.rb
flipper-1.3.0 lib/flipper/types/percentage.rb
flipper-1.3.0.pre lib/flipper/types/percentage.rb
flipper-1.2.2 lib/flipper/types/percentage.rb
flipper-1.2.1 lib/flipper/types/percentage.rb
flipper-1.2.0 lib/flipper/types/percentage.rb
flipper-1.1.2 lib/flipper/types/percentage.rb
flipper-1.1.1 lib/flipper/types/percentage.rb
flipper-1.1.0 lib/flipper/types/percentage.rb