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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0b8e9295228a2e77d91c53792ae3d03e80a1d03ac08a07e9aaa67d7ef636d5bc
4
- data.tar.gz: 8f31c8b8f79f2f405ed4ab41a309e903e12648eede70fc1b0653b9dfc3cd8bfd
3
+ metadata.gz: b049e7739e23a2dd36db7c54e2eeb7fd5b80fbe0d286b38349448edf23848edc
4
+ data.tar.gz: 219358f6990c08c35a257aaf7ebba37f64e577760d5bd2f6a39a6bb26fa63b55
5
5
  SHA512:
6
- metadata.gz: 1d2ccd11ede2794036ab9e0f5f71804a14796f1024b7cfa7bb4abe34cdf2c5013946f1922b543d7efd3c25d5f55fa221c902b5b90f4c191629a6c939817b91c8
7
- data.tar.gz: 985f3a8b727c61ff3197b928fce59d28322a9347b7b8be3a0fa0586feb6d07453282cc2ee41f497bf01763d624bde1a9d94adfe52ec2fcb586256a055b1570cc
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
@@ -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
@@ -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
- #!/usr/bin/env ruby
3
- # frozen_string_literal: true
4
-
5
- #$LOAD_PATH << './lib'
6
-
7
- require 'nmax'
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)
@@ -1,16 +1,18 @@
1
- require "nmax/version"
2
-
3
- module NmaxOleg
4
- def self.nmax(n = ARGV[0].to_i)
5
- if ARGV[1]
6
- puts "Enter only one argument"
7
- exit
8
- end
9
-
10
- numbers = []
11
- $stdin.each_line do |line|
12
- line.scan(/[0-9]{1,1000}/).each{|i| numbers << i.to_i}
13
- end
14
- puts numbers.uniq.sort.reverse[0...n]
15
- end
16
- end
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
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
- module NmaxOleg
4
- VERSION = '0.2.0'
5
- end
1
+ module NmaxOleg
2
+ VERSION = '0.2.1'
3
+ end
@@ -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-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
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
@@ -1,21 +1,26 @@
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
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
@@ -1,2 +1,2 @@
1
- require 'nmax'
2
- require 'rubygems'
1
+ require 'nmax'
2
+ require 'rubygems'
@@ -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.0
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-09-28 00:00:00.000000000 Z
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
@@ -1,3 +0,0 @@
1
- some text with number 12 and greater number then 22
2
- 11 addition number
3
- 30