Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core_extensions/string/percentage.rb

Overview

A bit of spicy monkey patching

Instance Method Summary collapse

Instance Method Details

#percentage?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/core_extensions/string/percentage.rb', line 3

def percentage?
  /\A[-+]?\d+\z/ =~ self && to_i >= 0 && to_i <= 100
end