Sha256: e9d77ec45a4ed8b7d683c12dcdb8b4fbb35b693b6b22ad723dfa9dd7b880019b

Contents?: true

Size: 350 Bytes

Versions: 842

Compression:

Stored size: 350 Bytes

Contents

# frozen_string_literal: true

module Playbook
  module Props
    class Percentage < Playbook::Props::Base
      def validate(value)
        value.nil? || numeric_in_range?(value)
      end

    private

      def numeric_in_range?(value)
        (value.is_a?(::Numeric) &&
          value <= 100 &&
          value >= 0)
      end
    end
  end
end

Version data entries

842 entries across 842 versions & 1 rubygems

Version Path
playbook_ui-2.9.7 app/pb_kits/playbook/props/percentage.rb
playbook_ui-2.9.6 app/pb_kits/playbook/props/percentage.rb