Module: Timewizard::Utils::Wizardry
- Defined in:
- lib/timewizard/utils/wizardry.rb
Overview
Contains utility functions in a cleverly named module.
Constant Summary collapse
- VERSION_REGEX =
/((\d+\.)?(\d+\.)?(\*|\d+))(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?/
Class Method Summary collapse
-
.only_version(stringy) ⇒ String
Returns a substring of the passed-in value that matches the version regex.
Class Method Details
.only_version(stringy) ⇒ String
Returns a substring of the passed-in value that matches the version regex.
16 17 18 19 20 21 |
# File 'lib/timewizard/utils/wizardry.rb', line 16 def self.only_version(stringy) if stringy.nil? raise ArgumentError, "stringy cannot be null" end VERSION_REGEX.match(stringy.to_s).to_s end |