Module: JSSRubyExtensions::String::Predicates
- Included in:
- String
- Defined in:
- lib/jss/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
-
#jss_float? ⇒ Boolean
Is this string also a floar? (i.e. it consists only of numberic digits).
-
#jss_integer? ⇒ Boolean
Is this string also an integer? (i.e. it consists only of numberic digits, maybe with a dash in front).
Instance Method Details
#jss_float? ⇒ Boolean
Is this string also a floar? (i.e. it consists only of numberic digits)
49 50 51 |
# File 'lib/jss/ruby_extensions/string/predicates.rb', line 49 def jss_float? self =~ FLOAT_RE ? true : false end |
#jss_integer? ⇒ Boolean
Is this string also an integer? (i.e. it consists only of numberic digits, maybe with a dash in front)
40 41 42 |
# File 'lib/jss/ruby_extensions/string/predicates.rb', line 40 def jss_integer? self =~ INTEGER_RE ? true : false end |