class Playbook::Props::Percentage

Public Instance Methods

validate(value) click to toggle source
# File lib/playbook/props/percentage.rb, line 6
def validate(value)
  value.nil? || numeric_in_range?(value)
end

Private Instance Methods

numeric_in_range?(value) click to toggle source
# File lib/playbook/props/percentage.rb, line 12
def numeric_in_range?(value)
  (value.is_a?(::Numeric) &&
    value <= 100 &&
    value >= 0)
end