Module: JamfRubyExtensions::String::Predicates

Included in:
String
Defined in:
lib/jamf/ruby_extensions/string/predicates.rb

Constant Summary collapse

INTEGER_RE =
/\A-?[0-9]+\Z/.freeze
FLOAT_RE =
/\A-?[0-9]+\.[0-9]+\Z/.freeze

Instance Method Summary collapse

Instance Method Details

#j_float?Boolean Also known as: jss_float?

Is this string also a floar? (i.e. it consists only of numberic digits)

Returns:

  • (Boolean)


50
51
52
# File 'lib/jamf/ruby_extensions/string/predicates.rb', line 50

def j_float?
  self =~ FLOAT_RE ? true : false
end

#j_integer?Boolean Also known as: jss_integer?

Is this string also an integer? (i.e. it consists only of numberic digits, maybe with a dash in front)

Returns:

  • (Boolean)


40
41
42
# File 'lib/jamf/ruby_extensions/string/predicates.rb', line 40

def j_integer?
  self =~ INTEGER_RE ? true : false
end