Module: Versionaire
- Defined in:
- lib/versionaire/function.rb,
lib/versionaire.rb,
lib/versionaire/cast.rb,
lib/versionaire/error.rb,
lib/versionaire/version.rb
Overview
The gem namespace.
Defined Under Namespace
Modules: Cast Classes: Error, Version
Constant Summary collapse
- DELIMITER =
"."
- PATTERN =
/ \A( # Start of string and OR. \d* # Major only. | # OR pipe. \d+ # Major. #{DELIMITER}? # Delimiter. \d* # Minor. (?:#{DELIMITER}\d+) # Passive delimiter and patch. )\z # End of OR and string. /x
Class Method Summary collapse
-
.Version(object) ⇒ Object
Conversion function (strict) for casting an object into a version.
Class Method Details
.Version(object) ⇒ Object
Conversion function (strict) for casting an object into a version.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/versionaire/function.rb', line 10 def Version object Converter.new(object).then do |converter| case object when String then converter.from_string when Array then converter.from_array when Hash then converter.from_hash when Version then object else converter.from_object end end end |