max_amount 0.1.1 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b69166cc9ce7c7049417265b96e121eee7bf571366c806017dd1b1706903571
4
- data.tar.gz: 23f810b9107a054b7a1723d4ba8dc3f37fb1b3488140d6a0fbdc307ecf2a5e67
3
+ metadata.gz: cf9b840576ec01dfd5f676102f6f6b2583b40b1f65bf658c3abd67d592548627
4
+ data.tar.gz: 7fa90c30fbd38db2571b74ec3241205a7f7e5b7f5b55a4b00cdfd4f42f790522
5
5
  SHA512:
6
- metadata.gz: f48cb025c2101290b6135e798a5484db4bc04f73d7d606155ecc7721e0ab973ef9cb2c3154f897b3bdcb50367464c42a3ecc14853eed46c4e26f7d99b43bf110
7
- data.tar.gz: ad8542f1b2f938a4b2b374c0c8a8e8fd38d4305ab9c45e6d10df33d58c807860a90ed1e434c9903a3f6541eac8c21dbe9ddf52655ff6cb9cd9292786edfd76ce
6
+ metadata.gz: 8ff40fc634062cb6d89ec7b955ba801c9fea5620e933d56a04ea00d92cbedc31ba075d901024492acf7cb1205f69d668a530ba0fe249ab183fede5a948666801
7
+ data.tar.gz: 065a188d876a81e9a0a26970895386c4fe7b0c0b1ada637c5e70b38d610d40e3f5c089aec2994db5741af68980a1d7c739dd53e5689eead2f9370d8984f4290b
data/.rubocop.yml CHANGED
@@ -3,7 +3,6 @@ require:
3
3
  - rubocop-rspec
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 3.0.3
7
6
  NewCops: enable
8
7
 
9
8
  Style/StringLiteralsInInterpolation:
data/Gemfile CHANGED
@@ -7,12 +7,14 @@ gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
9
 
10
+ gem 'fileutils'
11
+
10
12
  group :test do
11
- gem 'byebug', platforms: %i[mri mingw x64_mingw]
12
- gem 'dotenv', '~> 2.7'
13
+ gem 'byebug'
14
+ gem 'codecov', '~> 0.4'
13
15
  gem 'rspec', '~> 3.1'
14
16
  gem 'rubocop', '~> 1.36'
15
17
  gem 'rubocop-performance', '~> 1.15'
16
18
  gem 'rubocop-rspec', '~> 2.13'
17
- gem 'simplecov', require: false
19
+ gem 'simplecov', '~> 0.21'
18
20
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- max_amount (0.1.1)
4
+ max_amount (1.3.4)
5
5
  optparse
6
6
  securerandom
7
7
 
@@ -10,9 +10,11 @@ GEM
10
10
  specs:
11
11
  ast (2.4.2)
12
12
  byebug (11.1.3)
13
+ codecov (0.6.0)
14
+ simplecov (>= 0.15, < 0.22)
13
15
  diff-lcs (1.5.0)
14
16
  docile (1.4.0)
15
- dotenv (2.8.1)
17
+ fileutils (1.5.0)
16
18
  json (2.6.2)
17
19
  optparse (0.2.0)
18
20
  parallel (1.22.1)
@@ -67,14 +69,15 @@ PLATFORMS
67
69
 
68
70
  DEPENDENCIES
69
71
  byebug
70
- dotenv (~> 2.7)
72
+ codecov (~> 0.4)
73
+ fileutils
71
74
  max_amount!
72
75
  rake (~> 13.0)
73
76
  rspec (~> 3.1)
74
77
  rubocop (~> 1.36)
75
78
  rubocop-performance (~> 1.15)
76
79
  rubocop-rspec (~> 2.13)
77
- simplecov
80
+ simplecov (~> 0.21)
78
81
 
79
82
  BUNDLED WITH
80
83
  2.3.21
data/README.md CHANGED
@@ -1,33 +1,85 @@
1
- # MaxAmount
1
+ # max_amount
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/max_amount`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ ![Gem](https://img.shields.io/gem/v/max_amount)
4
+ ![CI](https://github.com/ProfessorNemo/max_amount/actions/workflows/ci.yml/badge.svg)
5
+ [![Test Coverage](https://codecov.io/gh/ProfessorNemo/max_amount/graph/badge.svg)](https://codecov.io/gh/ProfessorNemo/max_amount)
6
+ ![Downloads total](https://img.shields.io/gem/dt/max_amount)
4
7
 
5
- TODO: Delete this and the text above, and describe your gem
8
+ ## Скрипт выполняется следующее:
9
+ * читает из входящего потока текстовые данные;
10
+ * по завершении ввода выводит n самых больших целых чисел, встретившихся в
11
+ полученных текстовых данных.
12
+ Дополнительные сведения:
13
+ * числом считается любая непрерывная последовательность цифр в тексте;
14
+ * чисел длиннее 1000 цифр во входных данных нет;
15
+ * числа n,l и m - консольные параметры;
16
+ * код покрыт тестами;
17
+ * код оформлен в виде гема.
6
18
 
7
- ## Installation
19
+ ## Установка:
8
20
 
9
- Install the gem and add to the application's Gemfile by executing:
21
+ Добавьте
10
22
 
11
- $ bundle add max_amount
23
+ ``` rb
24
+ gem 'max_amount'
25
+ ```
12
26
 
13
- If bundler is not being used to manage dependencies, install the gem by executing:
27
+ И сделайте
14
28
 
15
- $ gem install max_amount
29
+ bundle
16
30
 
17
- ## Usage
31
+ Или сделайте
18
32
 
19
- TODO: Write usage instructions here
33
+ gem install max_amount
20
34
 
21
- ## Development
35
+ ## Использование:
22
36
 
23
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+ ``` rb
38
+ require 'max_amount'
24
39
 
25
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+ user_string = '24b6be4d91faa7d3469b9a0cc17d1d5267d21c5f8653ba4f70e3ef007'
26
41
 
27
- ## Contributing
42
+ user_string = nil if user_string.nil?
28
43
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/ProfessorNemo/max_amount.
44
+ $stdout.print "\n\n== Результат: ==\n\n"
30
45
 
31
- ## License
46
+ puts MaxAmount.result(user_string: user_string)
47
+ ```
32
48
 
33
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
49
+ ## Запуск:
50
+
51
+ ``` rb
52
+ ruby name_programm.rb --h
53
+
54
+ Результат:
55
+
56
+ Чтение из входящего потока текстовых данных:
57
+ --h Справка
58
+ --n Nmax n самых больших целых чисел (n > 0)
59
+ --l length длина строки
60
+ --m choice тестовая строка (m=1) / случайно сгенерированная строка (m=2) / пользовательская строка (m=3)
61
+
62
+
63
+ $ ruby name_programm.rb --n 10 --l 300 --m 3
64
+
65
+ Результат:
66
+
67
+ 8653
68
+ 5267
69
+ 3469
70
+ 91
71
+ 70
72
+ 24
73
+ 21
74
+ 17
75
+ 9
76
+ 7
77
+ ```
78
+
79
+ ## Помочь в разработке
80
+
81
+ Шлите ваши пулреквесты в https://github.com/ProfessorNemo/max_amount.
82
+
83
+ ## Лицензия
84
+
85
+ [MIT License](https://opensource.org/licenses/MIT)
data/Rakefile CHANGED
@@ -9,16 +9,14 @@ rescue LoadError
9
9
  puts 'although not required, bundler is recommened for running the tests'
10
10
  end
11
11
 
12
+ task default: :spec
13
+
12
14
  require 'bundler/gem_tasks'
13
15
  require 'rspec/core/rake_task'
14
-
15
16
  RSpec::Core::RakeTask.new(:spec)
16
17
 
17
18
  require 'rubocop/rake_task'
18
-
19
19
  RuboCop::RakeTask.new do |task|
20
20
  task.requires << 'rubocop-performance'
21
21
  task.requires << 'rubocop-rspec'
22
22
  end
23
-
24
- task default: %i[spec rubocop]
data/lib/main.rb CHANGED
@@ -1,13 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative 'max_amount/version'
4
-
5
- require 'byebug'
6
4
  require 'optparse'
7
5
  require 'securerandom'
8
- require 'dotenv/load'
9
-
10
6
  require_relative 'max_amount/options'
11
7
  require_relative 'max_amount/cli'
12
8
  require_relative 'max_amount/errors'
13
- require_relative 'max_amount/extract_integer'
9
+ require_relative 'max_amount/seeker'
@@ -1,19 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MaxAmount
4
- module CLI
4
+ module Cli
5
5
  extend MaxAmount::Options
6
6
 
7
- def self.call(custom_string:)
7
+ def self.call(user_string:)
8
8
  options = MaxAmount::Options.ask
9
9
 
10
10
  case options[:m]
11
11
  when '1'
12
- str = Dotenv.load('../.env')['TEST_STRING']
12
+ # str = File.read File.expand_path('../test/test_data.txt', __dir__).sub('/lib', '')
13
+ str = File.read File.expand_path('test_data.txt', __dir__)
13
14
  when '2'
14
15
  str = SecureRandom.hex(options[:l].to_i)
15
16
  when '3'
16
- str = custom_string
17
+ str = user_string
17
18
  end
18
19
 
19
20
  params = {
File without changes
@@ -0,0 +1,16 @@
1
+ xfsNZtpWsrKH1$OdTp35
2
+ lV$MHa@X$n05Uay04GPrO!xCAym8ezG&%-$yGEw1Ssf_qBqL
3
+ 0XjhTVE_PSys@GiLk%m&zdxtycv_6lLA73Rd8rYjarRTn
4
+ $Ha_2PF_Zqhk-b
5
+ I1Anb7bKOuQW5@o9oHMduF%
6
+ 8F3zkJai0
7
+ X4tPsfqos5qudf#.oqQKDkCNtG
8
+ g0oBCqch%$j!lKF80b6nn
9
+ A.DxrUqh!6-PXrIlTAbn#imlbu-UVoj96ArvYEKyE6Lz94sKSQ-kS4DdEfqsuI-yLgXXyntFH#47YNa
10
+ gNJyuzrk@S73eUUP!Lnn$l@iPDvS6b3&uZAKPfBTVEPDdtLdIkG27
11
+ Zcc18SOQ0P&%WLwfFh@Eqcw
12
+ ntISbSV#3FGVJz__zcGnOvOgB
13
+ dbFcrcAuu$Hf!i%GxjEF46r@!Qhq9iR$gxb7tgD&sFBZy-xFq
14
+ jM7J.2X%Erb@ukP&g$zxc%Y_$sq0MNUO#l#QzV4.Jxq50uCaYF&J9J3o@WF2fm2uBqPrcvuDS$DCJbw!kCNP.IurST.%-f!-cNmNJJ4Y_S2hXLc5dB5evaD-NYX8z1Af$e8Bf1jPXoP7vDL
15
+ 5bWcCuRJdI&o2vJz-dDHSma%gJa&$e2RJ4kq7FmiTQyHB6gKgzSi1Oqouqh%eF3ErnLvj&sqp-hZY8-yr0$A4c&#8.rMZuVdZNLMCDU!w3rV806xG@SIudZbKmjpcVNfMVBJNeEzUIC7YxKzI0$lw!@cobkk_SkAUSjTpYLvzph.Bp!H4Cfmh!oTs2Fcg7&&!C.Forlg%jlv%-n68kjY5m8N#4v@w9eAjaQJdpU2Bg.ULkJe.5c$wEV!E.EKo2A1H8C#-HnupTT6iD#s4X1TxlKdZlLK!.QAAjx
16
+ k-4g$amq4Fn6K44dj4uyzxISEb2UvWO4rsPb1E2e.BSNCqK8NAYa%Qkxghvm$qneBpMc0A7Xzoma@TMeZJh9&OorU2FD9fS_XZIugrxf#q3IPIFqoCsU
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MaxAmount
4
- VERSION = '0.1.1'
4
+ VERSION = '1.3.4'
5
5
  end
data/lib/max_amount.rb ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'main'
4
+
5
+ # Main MaxAmount module
6
+ module MaxAmount
7
+ def self.result(user_string = nil)
8
+ MaxAmount::Cli.call(user_string: user_string)
9
+ end
10
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: max_amount
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gleb V. Zhegilin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-30 00:00:00.000000000 Z
11
+ date: 2022-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: optparse
@@ -38,8 +38,9 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Reading text data and outputting the n largest integers encountered in
42
- the received text data.When input is complete, prints the n largest integers.
41
+ description: |-
42
+ Reading text data and outputting the n largest integers encountered in the received text data.
43
+ When input is complete, prints the n largest integers.
43
44
  email:
44
45
  - gleboceanborn@gmail.com
45
46
  executables: []
@@ -55,18 +56,20 @@ files:
55
56
  - LICENSE.txt
56
57
  - README.md
57
58
  - Rakefile
58
- - examples/max_amount.rb
59
59
  - lib/main.rb
60
+ - lib/max_amount.rb
60
61
  - lib/max_amount/cli.rb
61
62
  - lib/max_amount/errors.rb
62
- - lib/max_amount/extract_integer.rb
63
63
  - lib/max_amount/options.rb
64
+ - lib/max_amount/seeker.rb
65
+ - lib/max_amount/test_data.txt
64
66
  - lib/max_amount/version.rb
65
- - sig/max_amount.rbs
66
67
  homepage: https://github.com/ProfessorNemo/max_amount
67
68
  licenses:
68
69
  - MIT
69
70
  metadata:
71
+ homepage_uri: https://github.com/ProfessorNemo/max_amount
72
+ source_code_uri: https://github.com/ProfessorNemo/max_amount
70
73
  rubygems_mfa_required: 'true'
71
74
  post_install_message:
72
75
  rdoc_options: []
@@ -76,7 +79,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
76
79
  requirements:
77
80
  - - ">="
78
81
  - !ruby/object:Gem::Version
79
- version: 3.0.3
82
+ version: 3.0.2
80
83
  required_rubygems_version: !ruby/object:Gem::Requirement
81
84
  requirements:
82
85
  - - ">="
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../lib/main'
4
-
5
- # путь к файлу с пользовательской строкой
6
- path = File.expand_path('../spec/support/fixtures/sample_data.txt', __dir__)
7
-
8
- # если файла нет, то присваиваем nil
9
- custom_string = File.exist?(path) ? File.read(path) : nil
10
-
11
- MaxAmount::CLI.call(custom_string: custom_string)
data/sig/max_amount.rbs DELETED
@@ -1,4 +0,0 @@
1
- module MaxAmount
2
- VERSION: String
3
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
- end