nmax_oleg 0.2.0 → 0.2.1
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 +4 -4
- data/.gitignore +18 -18
- data/.rspec +2 -2
- data/.rubocop.yml +13 -13
- data/.travis.yml +5 -4
- data/Gemfile +10 -10
- data/LICENSE +21 -21
- data/README.md +1 -1
- data/Rakefile +8 -8
- data/bin/nmax +7 -11
- data/lib/nmax.rb +18 -16
- data/lib/nmax/version.rb +3 -5
- data/nmax.gemspec +19 -19
- data/spec/nmax_spec.rb +26 -21
- data/spec/spec_helper.rb +2 -2
- data/spec/text/text.txt +1 -1
- metadata +2 -4
- data/123.txt +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b049e7739e23a2dd36db7c54e2eeb7fd5b80fbe0d286b38349448edf23848edc
|
4
|
+
data.tar.gz: 219358f6990c08c35a257aaf7ebba37f64e577760d5bd2f6a39a6bb26fa63b55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2725b7a480fd5c823ebc40b9bca08ca7c7169846c8b292e75ab2691ca4f9d7ad250b494ffc9343292afaf68e1046cf8a46453a533fe21856df82dd1a3efee26d
|
7
|
+
data.tar.gz: aa4cbb6bf6577f5c4984ec7ec3de4b904a39b167892a63421be2481f170ce07b1ebfdf68dce9b614f47643df7a40eff9d190ef75e0a7faea065b68346be07394
|
data/.gitignore
CHANGED
@@ -1,18 +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
|
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
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--require spec_helper
|
2
|
-
--format documentation
|
1
|
+
--require spec_helper
|
2
|
+
--format documentation
|
data/.rubocop.yml
CHANGED
@@ -1,13 +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
|
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
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
rvm:
|
4
|
-
- 2.6.5
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
rvm:
|
4
|
+
- 2.6.5
|
5
|
+
- 2.7.0
|
data/Gemfile
CHANGED
@@ -1,10 +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'
|
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/LICENSE
CHANGED
@@ -1,21 +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.
|
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
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# nmax_oleg
|
1
|
+
# nmax_oleg
|
2
2
|
Program finds n greatest numbers from the input text
|
data/Rakefile
CHANGED
@@ -1,8 +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
|
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
CHANGED
@@ -1,11 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
puts 'Hi 0.2.0'
|
10
|
-
#puts Nmax.get(stdin: STDIN, count: ARGV[0].to_i)
|
11
|
-
NmaxOleg.nmax
|
1
|
+
require 'nmax'
|
2
|
+
|
3
|
+
puts "Hi nmax_oleg!"
|
4
|
+
|
5
|
+
n = ARGV[0].to_i
|
6
|
+
|
7
|
+
NmaxOleg.nmax($stdin, n)
|
data/lib/nmax.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
require "nmax/version"
|
2
|
-
|
3
|
-
module NmaxOleg
|
4
|
-
def self.nmax(
|
5
|
-
if ARGV[1]
|
6
|
-
puts "Enter only one argument"
|
7
|
-
exit
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
require "nmax/version"
|
2
|
+
|
3
|
+
module NmaxOleg
|
4
|
+
def self.nmax(stdin = $stdin, n)
|
5
|
+
if ARGV[1]
|
6
|
+
puts "Enter only one argument please"
|
7
|
+
exit
|
8
|
+
elsif n == 0
|
9
|
+
puts "Enter one number please"
|
10
|
+
end
|
11
|
+
|
12
|
+
numbers = []
|
13
|
+
stdin.each_line do |line|
|
14
|
+
line.scan(/[0-9]{1,1000}/).each{|i| numbers << i.to_i}
|
15
|
+
end
|
16
|
+
puts numbers.uniq.sort.reverse[0...n]
|
17
|
+
end
|
18
|
+
end
|
data/lib/nmax/version.rb
CHANGED
data/nmax.gemspec
CHANGED
@@ -1,19 +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-
|
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
|
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-10-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
CHANGED
@@ -1,21 +1,26 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
RSpec.describe NmaxOleg do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
let(:
|
8
|
-
let(:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
RSpec.describe NmaxOleg do
|
4
|
+
describe NmaxOleg do
|
5
|
+
n = 6
|
6
|
+
string = StringIO.new("1411 888 23 42 8 15\n")
|
7
|
+
#let(:test_path) { File.dirname(__FILE__) + '/text/text.txt' }
|
8
|
+
#let(:test) { File.open(test_path) }
|
9
|
+
|
10
|
+
it "has a version number" do
|
11
|
+
expect(NmaxOleg::VERSION).not_to be nil
|
12
|
+
end
|
13
|
+
|
14
|
+
it "does something useful" do
|
15
|
+
expect(true).to eq(true)
|
16
|
+
end
|
17
|
+
|
18
|
+
#it ".should return the user's input" do
|
19
|
+
# expect(subject.nmax(test, n)).to eq([12435, 2324, 864, 78, 69, 34])
|
20
|
+
#end
|
21
|
+
|
22
|
+
#it "should return the user's input" do
|
23
|
+
# expect(subject.nmax(string, n)).to eq [1411, 888, 23, 42, 8, 15]
|
24
|
+
#end
|
25
|
+
end
|
26
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
require 'nmax'
|
2
|
-
require 'rubygems'
|
1
|
+
require 'nmax'
|
2
|
+
require 'rubygems'
|
data/spec/text/text.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
dcdsv2324 4 dfdsf ujtr6nd34:fds864-69_12435 4fvdsfb78
|
1
|
+
dcdsv2324 4 dfdsf ujtr6nd34:fds864-69_12435 4fvdsfb78
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nmax_oleg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oleg Stepanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Program finds n greatest numbers from the input text.
|
14
14
|
email: oleg1107@rambler.ru
|
@@ -21,9 +21,7 @@ files:
|
|
21
21
|
- ".rspec"
|
22
22
|
- ".rubocop.yml"
|
23
23
|
- ".travis.yml"
|
24
|
-
- 123.txt
|
25
24
|
- Gemfile
|
26
|
-
- Gemfile.lock
|
27
25
|
- LICENSE
|
28
26
|
- README.md
|
29
27
|
- Rakefile
|
data/123.txt
DELETED