lib/core/helpers.rb in cpl-1.4.0 vs lib/core/helpers.rb in cpl-2.2.0

- old
+ new

@@ -1,16 +1,26 @@ # frozen_string_literal: true require "securerandom" module Helpers + module_function + def strip_str_and_validate(str) return str if str.nil? str = str.strip str.empty? ? nil : str end def random_four_digits SecureRandom.random_number(1000..9999) + end + + def normalize_command_name(name) + name.to_s.tr("_", "-") + end + + def normalize_option_name(name) + "--#{name.to_s.tr('_', '-')}" end end