nmax_oleg 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2d6724cc2deac09b683b418e660086b6d94040b14af682d83804761239e8d3d0
4
+ data.tar.gz: c7fcec203a53f54d1095b0db0026320f3277bbca13e43e02f50daef355c0a684
5
+ SHA512:
6
+ metadata.gz: 479f4a95ab036b4157773709b9eb255259d010a9e0a022b6ee42d367fabf34e4afa0179ebd7d5a630085e65cd22679a6cbac42ca7884d9397b0dad13f8613aea
7
+ data.tar.gz: b14090fd272e369cec38c7165df313369d99bd526c19f893d3aea294d5604e0c11e24ca17e22fa51648a37470f78cfbb5092d1c5e998755965be0000db12b477
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ usage.rb
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --require spec_helper
2
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ # inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 2.6
5
+
6
+ Documentation:
7
+ Enabled: false
8
+
9
+ Metrics/LineLength:
10
+ Max: 120
11
+
12
+ Style/SymbolArray:
13
+ Enabled: true
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 2.6.5
data/123.txt ADDED
@@ -0,0 +1,3 @@
1
+ some text with number 12 and greater number then 22
2
+ 11 addition number
3
+ 30
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ gem 'rubocop'
8
+ gem 'travis'
9
+ gem 'rspec'
10
+ gem 'rake'
data/Gemfile.lock ADDED
@@ -0,0 +1,104 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ nmax_oleg (0.1.4)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (5.2.4.4)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 0.7, < 2)
12
+ minitest (~> 5.1)
13
+ tzinfo (~> 1.1)
14
+ addressable (2.7.0)
15
+ public_suffix (>= 2.0.2, < 5.0)
16
+ ast (2.4.1)
17
+ concurrent-ruby (1.1.7)
18
+ diff-lcs (1.4.4)
19
+ faraday (1.0.1)
20
+ multipart-post (>= 1.2, < 3)
21
+ faraday_middleware (1.0.0)
22
+ faraday (~> 1.0)
23
+ gh (0.18.0)
24
+ activesupport (~> 5.0)
25
+ addressable (~> 2.4)
26
+ faraday (~> 1.0)
27
+ faraday_middleware (~> 1.0)
28
+ multi_json (~> 1.0)
29
+ net-http-persistent (~> 2.9)
30
+ net-http-pipeline
31
+ highline (2.0.3)
32
+ i18n (1.8.5)
33
+ concurrent-ruby (~> 1.0)
34
+ json (2.3.1)
35
+ json_pure (2.3.1)
36
+ launchy (2.4.3)
37
+ addressable (~> 2.3)
38
+ minitest (5.14.2)
39
+ multi_json (1.15.0)
40
+ multipart-post (2.1.1)
41
+ net-http-persistent (2.9.4)
42
+ net-http-pipeline (1.0.1)
43
+ parallel (1.19.2)
44
+ parser (2.7.1.5)
45
+ ast (~> 2.4.1)
46
+ public_suffix (4.0.6)
47
+ pusher-client (0.6.2)
48
+ json
49
+ websocket (~> 1.0)
50
+ rainbow (3.0.0)
51
+ rake (13.0.1)
52
+ regexp_parser (1.8.1)
53
+ rexml (3.2.4)
54
+ rspec (3.9.0)
55
+ rspec-core (~> 3.9.0)
56
+ rspec-expectations (~> 3.9.0)
57
+ rspec-mocks (~> 3.9.0)
58
+ rspec-core (3.9.2)
59
+ rspec-support (~> 3.9.3)
60
+ rspec-expectations (3.9.2)
61
+ diff-lcs (>= 1.2.0, < 2.0)
62
+ rspec-support (~> 3.9.0)
63
+ rspec-mocks (3.9.1)
64
+ diff-lcs (>= 1.2.0, < 2.0)
65
+ rspec-support (~> 3.9.0)
66
+ rspec-support (3.9.3)
67
+ rubocop (0.92.0)
68
+ parallel (~> 1.10)
69
+ parser (>= 2.7.1.5)
70
+ rainbow (>= 2.2.2, < 4.0)
71
+ regexp_parser (>= 1.7)
72
+ rexml
73
+ rubocop-ast (>= 0.5.0)
74
+ ruby-progressbar (~> 1.7)
75
+ unicode-display_width (>= 1.4.0, < 2.0)
76
+ rubocop-ast (0.7.1)
77
+ parser (>= 2.7.1.5)
78
+ ruby-progressbar (1.10.1)
79
+ thread_safe (0.3.6)
80
+ travis (1.10.0)
81
+ faraday (~> 1.0)
82
+ faraday_middleware (~> 1.0)
83
+ gh (~> 0.13)
84
+ highline (~> 2.0)
85
+ json_pure (~> 2.3)
86
+ launchy (~> 2.1, < 2.5.0)
87
+ pusher-client (~> 0.4)
88
+ tzinfo (1.2.7)
89
+ thread_safe (~> 0.1)
90
+ unicode-display_width (1.7.0)
91
+ websocket (1.2.8)
92
+
93
+ PLATFORMS
94
+ x64-mingw32
95
+
96
+ DEPENDENCIES
97
+ nmax_oleg!
98
+ rake
99
+ rspec
100
+ rubocop
101
+ travis
102
+
103
+ BUNDLED WITH
104
+ 2.1.4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Oleg Stepanov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # nmax_oleg
2
+ Program finds n greatest numbers from the input text
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => :spec
data/bin/nmax ADDED
@@ -0,0 +1,11 @@
1
+
2
+ #!/usr/bin/env ruby
3
+ # frozen_string_literal: true
4
+
5
+ #$LOAD_PATH << './lib'
6
+
7
+ require 'nmax'
8
+
9
+ puts 'Hi 2'
10
+ #puts Nmax.get(stdin: STDIN, count: ARGV[0].to_i)
11
+ puts NmaxOleg.nmax
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NmaxOleg
4
+ VERSION = '0.1.4'
5
+ end
data/lib/nmax.rb ADDED
@@ -0,0 +1,16 @@
1
+ require "nmax/version"
2
+
3
+ module NmaxOleg
4
+ def self.nmax(file, n)
5
+ if ARGV[2]
6
+ puts "Enter only one argument"
7
+ exit
8
+ end
9
+
10
+ numbers = []
11
+ file.each_line do |line|
12
+ line.scan(/[0-9]{1,1000}/).each{|i| numbers << i.to_i}
13
+ end
14
+ numbers.uniq.sort.reverse[0...n.to_i]
15
+ end
16
+ end
data/nmax.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('../lib/nmax/version', __FILE__)
4
+
5
+ Gem::Specification.new 'nmax_oleg', NmaxOleg::VERSION do |s|
6
+ s.date = '2020-09-28'
7
+ s.summary = 'nmax_oleg is a simple gem for finding numbers in text'
8
+ s.description = 'Program finds n greatest numbers from the input text.'
9
+ s.author = 'Oleg Stepanov'
10
+ s.email = 'oleg1107@rambler.ru'
11
+ s.homepage = 'https://github.com/Oleg-rb/nmax_oleg'
12
+ s.license = 'MIT'
13
+ s.files = `git ls-files`.split("\n")
14
+ s.test_files = `git ls-files -- {test,spec,text}/*`.split("\n")
15
+ s.executables = `git ls-files -- bin`.split.map { |f| File.basename(f) }
16
+ s.require_paths = ["lib"]
17
+ s.platform = Gem::Platform::RUBY
18
+ s.post_install_message = 'Thanks for installing!'
19
+ end
data/spec/nmax_spec.rb ADDED
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe NmaxOleg do
4
+
5
+ describe NmaxOleg do
6
+ let(:text_file) { File.dirname(__FILE__) + '/text/text.txt' }
7
+ let(:file) { File.open(text_file) }
8
+ let(:n) {5}
9
+ it "process_numbers outputs an array of integers" do
10
+ expect(subject.nmax(file, n).all? { |a| a.class == Integer }).to be_truthy
11
+ end
12
+
13
+ it "process_numbers outputs an array with n elements" do
14
+ expect(subject.nmax(file, n).count).to eq(5)
15
+ end
16
+
17
+ it "process_numbers correctly picks integers from stream" do
18
+ expect(subject.nmax(file, n)).to eq([12435, 2324, 864, 78, 69])
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,2 @@
1
+ require 'nmax'
2
+ require 'rubygems'
@@ -0,0 +1 @@
1
+ dcdsv2324 4 dfdsf ujtr6nd34:fds864-69_12435 4fvdsfb78
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nmax_oleg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
5
+ platform: ruby
6
+ authors:
7
+ - Oleg Stepanov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-09-28 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Program finds n greatest numbers from the input text.
14
+ email: oleg1107@rambler.ru
15
+ executables:
16
+ - nmax
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - ".gitignore"
21
+ - ".rspec"
22
+ - ".rubocop.yml"
23
+ - ".travis.yml"
24
+ - 123.txt
25
+ - Gemfile
26
+ - Gemfile.lock
27
+ - LICENSE
28
+ - README.md
29
+ - Rakefile
30
+ - bin/nmax
31
+ - lib/nmax.rb
32
+ - lib/nmax/version.rb
33
+ - nmax.gemspec
34
+ - spec/nmax_spec.rb
35
+ - spec/spec_helper.rb
36
+ - spec/text/text.txt
37
+ homepage: https://github.com/Oleg-rb/nmax_oleg
38
+ licenses:
39
+ - MIT
40
+ metadata: {}
41
+ post_install_message: Thanks for installing!
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubygems_version: 3.1.4
57
+ signing_key:
58
+ specification_version: 4
59
+ summary: nmax_oleg is a simple gem for finding numbers in text
60
+ test_files: []