lib/versionaire/function.rb in versionaire-12.1.1 vs lib/versionaire/function.rb in versionaire-13.0.0
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
-require "refinements/arrays"
-require "refinements/structs"
+require "refinements/array"
+require "refinements/struct"
# The gem namespace.
module Versionaire
module_function
@@ -20,12 +20,12 @@
end
end
# Aids with converting objects into valid versions.
class Converter
- using Refinements::Arrays
- using Refinements::Structs
+ using Refinements::Array
+ using Refinements::Struct
def initialize object, model: Version
@object = object
@model = model
end
@@ -39,11 +39,11 @@
def from_array
body = "Use: [<major>, <minor>, <patch>], [<major>, <minor>], [<major>], or []."
fail Error, error_message(object, body) unless (0..3).cover? object.size
- model.with_positions(*object.pad(0, max: 3))
+ model.with_positions(*object.pad(0, 3))
end
def from_hash
body = "Use: {major: <major>, minor: <minor>, patch: <patch>}, " \
"{major: <major>, minor: <minor>}, {major: <major>}, or {}."
@@ -61,10 +61,10 @@
attr_reader :object, :model
def string_to_version
object.split(DELIMITER)
.map(&:to_i)
- .then { |numbers| numbers.pad 0, max: 3 }
+ .then { |numbers| numbers.pad 0, 3 }
.then { |arguments| model.with_positions(*arguments) }
end
def required_keys? = object.keys.all? { |key| model.members.include? key }