module JwtClaims::StringOrUri
Validation
helpers
Constants
- BLANK_STRING_RE
Public Instance Methods
blank?(a)
click to toggle source
A string is blank if it is empty or contains whitespaces only
blank?('') # => true blank?(' ') # => true blank?("\t\n\r") # => true blank?('foo ') # => false
@param a [String] @return [true, false] @see cf. rails activesupport/lib/active_support/core_ext/object/blank.rb
# File lib/jwt_claims/string_or_uri.rb, line 38 def blank?(a) return true unless a BLANK_STRING_RE === a end
present?(a)
click to toggle source
A string is present if it is not blank
@param a [String] @return [true, false]
# File lib/jwt_claims/string_or_uri.rb, line 24 def present?(a) !blank?(a) end
present_and_equal?(a, b)
click to toggle source
A predicate that compares two strings for equality
@param a [String] @param b [String] @return [true, false]
# File lib/jwt_claims/string_or_uri.rb, line 14 def present_and_equal?(a, b) present?(a) && present?(b) && a == b end