max_amount 0.1.1 → 1.2.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: 350f0cfbb9d43c276d77656c980744b9efaffc94d81f6148853c1ca2db8847c0
4
+ data.tar.gz: d3794227bd0722cad8a04a1be6429d3e13c9b19b7ab701c0bc144b3da7ff96cd
5
5
  SHA512:
6
- metadata.gz: f48cb025c2101290b6135e798a5484db4bc04f73d7d606155ecc7721e0ab973ef9cb2c3154f897b3bdcb50367464c42a3ecc14853eed46c4e26f7d99b43bf110
7
- data.tar.gz: ad8542f1b2f938a4b2b374c0c8a8e8fd38d4305ab9c45e6d10df33d58c807860a90ed1e434c9903a3f6541eac8c21dbe9ddf52655ff6cb9cd9292786edfd76ce
6
+ metadata.gz: 25748ccb9b6900974780d6ee5a00a66f866286392e60d94c3d4c530f476a9cca66c2bca7e1e716ca5783c5d5126eba1a33531e0abedefe5345bc704a61083405
7
+ data.tar.gz: 5b284bada3aff0867af14f2ccd836f0c865321cd786f48fae30ba479641b149db28b797fc869ee2c9b5f67a096852c534729d0455ffc19618e85a38340d7d42b
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.2.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,80 @@
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
+ ## Скрипт выполняется следующее:
4
+ * читает из входящего потока текстовые данные;
5
+ * по завершении ввода выводит n самых больших целых чисел, встретившихся в
6
+ полученных текстовых данных.
7
+ Дополнительные сведения:
8
+ * числом считается любая непрерывная последовательность цифр в тексте;
9
+ * чисел длиннее 1000 цифр во входных данных нет;
10
+ * числа n,l и m - консольные параметры;
11
+ * код покрыт тестами;
12
+ * код оформлен в виде гема.
4
13
 
5
- TODO: Delete this and the text above, and describe your gem
14
+ ## Установка:
6
15
 
7
- ## Installation
16
+ Добавьте
8
17
 
9
- Install the gem and add to the application's Gemfile by executing:
18
+ ``` rb
19
+ gem 'max_amount'
20
+ ```
10
21
 
11
- $ bundle add max_amount
22
+ И сделайте
12
23
 
13
- If bundler is not being used to manage dependencies, install the gem by executing:
24
+ bundle
14
25
 
15
- $ gem install max_amount
26
+ Или сделайте
16
27
 
17
- ## Usage
28
+ gem install max_amount
18
29
 
19
- TODO: Write usage instructions here
30
+ ## Использование:
20
31
 
21
- ## Development
32
+ ``` rb
33
+ require 'max_amount'
22
34
 
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.
35
+ user_string = '24b6be4d91faa7d3469b9a0cc17d1d5267d21c5f8653ba4f70e3ef007'
24
36
 
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).
37
+ user_string = nil if user_string.nil?
26
38
 
27
- ## Contributing
39
+ $stdout.print "\n\n== Результат: ==\n\n"
28
40
 
29
- Bug reports and pull requests are welcome on GitHub at https://github.com/ProfessorNemo/max_amount.
41
+ puts MaxAmount.result(user_string: user_string)
42
+ ```
30
43
 
31
- ## License
44
+ ## Запуск:
32
45
 
33
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+ ``` rb
47
+ ruby name_programm.rb --h
48
+
49
+ Результат:
50
+
51
+ Чтение из входящего потока текстовых данных:
52
+ --h Справка
53
+ --n Nmax n самых больших целых чисел (n > 0)
54
+ --l length длина строки
55
+ --m choice тестовая строка (m=1) / случайно сгенерированная строка (m=2) / пользовательская строка (m=3)
56
+
57
+
58
+ $ ruby name_programm.rb --n 10 --l 300 --m 3
59
+
60
+ Результат:
61
+
62
+ 8653
63
+ 5267
64
+ 3469
65
+ 91
66
+ 70
67
+ 24
68
+ 21
69
+ 17
70
+ 9
71
+ 7
72
+ ```
73
+
74
+ ## Помочь в разработке
75
+
76
+ Шлите ваши пулреквесты в https://github.com/ProfessorNemo/max_amount.
77
+
78
+ ## Лицензия
79
+
80
+ [MIT License](https://opensource.org/licenses/MIT)
data/Rakefile CHANGED
@@ -1,14 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rake'
4
-
5
- begin
6
- require 'bundler/setup'
7
- Bundler::GemHelper.install_tasks
8
- rescue LoadError
9
- puts 'although not required, bundler is recommened for running the tests'
10
- end
11
-
12
3
  require 'bundler/gem_tasks'
13
4
  require 'rspec/core/rake_task'
14
5
 
data/lib/main.rb CHANGED
@@ -1,13 +1,10 @@
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
6
  require 'dotenv/load'
9
-
10
7
  require_relative 'max_amount/options'
11
8
  require_relative 'max_amount/cli'
12
9
  require_relative 'max_amount/errors'
13
- require_relative 'max_amount/extract_integer'
10
+ 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,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U2FD9fS_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.2.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.2.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-01 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