Module: Hammerhead::Utils

Included in:
Commands::Status, Harvest::Connection
Defined in:
lib/hammerhead/utils.rb

Overview

Contains utility-type methods available for use throughout the tool.

Instance Method Summary collapse

Instance Method Details

#digits?(input) ⇒ Boolean

Returns true if the specified input consists of digits

digits? '1234' => true
digits? 'abcd' => false

Uses a regular expression to determine if all the specified characters are numeric.

Returns:

  • (Boolean)


17
18
19
# File 'lib/hammerhead/utils.rb', line 17

def digits? input
  input.match?(/\A\d+\Z/)
end