class Paypal::Masspay::LengthValidator

Public Class Methods

validate(string, length, field_name) click to toggle source
# File lib/paypal/masspay/length_validator.rb, line 5
def self.validate(string, length, field_name)
  string.tap do |output|
    raise FieldLengthTooLarge.new("#{output} is longer than the paypal max char limit of #{length} for field #{field_name}") if !output.nil? && output.length > length
  end
end