Sha256: 00cc9e72351efcbef9a75623c1d0114e4d62d69cb8f43d1ed685cb175eb3a8d7
Contents?: true
Size: 860 Bytes
Versions: 8
Compression:
Stored size: 860 Bytes
Contents
# frozen_string_literal: true module MaxAmount module Cli extend MaxAmount::Options def self.call(user_string:) options = MaxAmount::Options.ask case options[:m] when '1' # str = File.read File.expand_path('../test/test_data.txt', __dir__).sub('/lib', '') str = File.read File.expand_path('test_data.txt', __dir__) when '2' str = SecureRandom.hex(options[:l].to_i) when '3' str = user_string end params = { text: str, nmax: options[:n]&.to_i } params[:text] = params[:text].to_s.chomp unless params[:text].is_a?(String) begin output = MaxAmount::Seeker.new(params).check_errors.search.join("\n") puts output rescue MaxAmount::Error => e message = e.message puts message end end end end
Version data entries
8 entries across 8 versions & 1 rubygems