hexlet-pairs 1.0.0 → 1.1.0

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: 5a2eb18f3c135b536517372b683af1baef6e862276473cba1cd3f034e9d6a0ff
4
- data.tar.gz: c9a0d76bd2033187957d821dd546449451ba21f125cf1b94fdb9b4fef0289285
3
+ metadata.gz: d58a66470664baf485f14c47b86ff9d62836d93d835fb72c5bc80e1916d8e45f
4
+ data.tar.gz: 901b42c7381ebfe5604b3ff6248b78fd21d297fb9bc690be0f00f42d8b907985
5
5
  SHA512:
6
- metadata.gz: adf597ba8901a89c094833e0eba33f24ac7d82f9276176e51ecf518f37d0ef26656b0951db07c39241fb7dea7245b4e91ab7b57b0c23e3607e02c92d41679021
7
- data.tar.gz: 6886edf2d13555fbaeb9e0193798cd78b27ec1939dd53329f151062cd760fff9d0f9b0477ceab3e64f5d0d79a249d2d14a4149ec8f1db2cccdf6811643b1f459
6
+ metadata.gz: 692063d31463062f9ecb5a3104b381e76c87c38494b06bcc61628cc3bd8a08f979d9038508047cebd0971e39d6a56f1c2e9e98f244575144fd0f473140871188
7
+ data.tar.gz: fda972636e9b3603d2d890fa873eb81cc1ed0e3e324834eae34e527634f2c76b25cc404bed1a0dd0672fabd5bec8641e55f4a21de27eb59087911fed454e230c
data/.rubocop.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - "vendor/**/*"
4
+ - hexlet-pairs.gemspec
4
5
  NewCops: enable
5
6
 
6
7
  Style/FrozenStringLiteralComment:
data/Gemfile CHANGED
@@ -1,5 +1,9 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gemspec
4
+
3
5
  gem 'rspec', '~> 3.10'
4
6
 
5
- gem 'rubocop', '~> 1.1'
7
+ gem 'rubocop', '~> 1.12.1'
8
+
9
+ gem 'rubocop-rspec', '~> 2.2.0'
data/Gemfile.lock CHANGED
@@ -1,14 +1,19 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hexlet-pairs (1.1.0)
5
+
1
6
  GEM
2
7
  remote: https://rubygems.org/
3
8
  specs:
4
9
  ast (2.4.2)
5
10
  diff-lcs (1.4.4)
6
11
  parallel (1.20.1)
7
- parser (3.0.0.0)
12
+ parser (3.0.1.0)
8
13
  ast (~> 2.4.1)
9
14
  rainbow (3.0.0)
10
15
  regexp_parser (2.1.1)
11
- rexml (3.2.4)
16
+ rexml (3.2.5)
12
17
  rspec (3.10.0)
13
18
  rspec-core (~> 3.10.0)
14
19
  rspec-expectations (~> 3.10.0)
@@ -22,7 +27,7 @@ GEM
22
27
  diff-lcs (>= 1.2.0, < 2.0)
23
28
  rspec-support (~> 3.10.0)
24
29
  rspec-support (3.10.2)
25
- rubocop (1.11.0)
30
+ rubocop (1.12.1)
26
31
  parallel (~> 1.10)
27
32
  parser (>= 3.0.0.0)
28
33
  rainbow (>= 2.2.2, < 4.0)
@@ -33,6 +38,9 @@ GEM
33
38
  unicode-display_width (>= 1.4.0, < 3.0)
34
39
  rubocop-ast (1.4.1)
35
40
  parser (>= 2.7.1.5)
41
+ rubocop-rspec (2.2.0)
42
+ rubocop (~> 1.0)
43
+ rubocop-ast (>= 1.1.0)
36
44
  ruby-progressbar (1.11.0)
37
45
  unicode-display_width (2.0.0)
38
46
 
@@ -40,8 +48,10 @@ PLATFORMS
40
48
  ruby
41
49
 
42
50
  DEPENDENCIES
51
+ hexlet-pairs!
43
52
  rspec (~> 3.10)
44
- rubocop (~> 1.1)
53
+ rubocop (~> 1.12.1)
54
+ rubocop-rspec (~> 2.2.0)
45
55
 
46
56
  BUNDLED WITH
47
- 2.1.4
57
+ 2.2.15
data/Makefile CHANGED
@@ -1,5 +1,5 @@
1
1
  install:
2
- bundle install
2
+ bundle
3
3
 
4
4
  test:
5
5
  bundle exec rspec
data/README.md CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  [![github action status](https://github.com/hexlet-components/ruby-pairs/workflows/CI/badge.svg)](https://github.com/hexlet-components/ruby-pairs/actions)
4
4
 
5
+ ## Install
6
+
7
+ ```sh
8
+ gem install hexlet-pairs
9
+ ```
10
+
5
11
  ## Usage example
6
12
 
7
13
  ```ruby
8
- require 'hexlet/pairs'
14
+ require 'pairs'
9
15
 
10
16
  pair = Pairs.cons(3, 5)
11
17
 
@@ -1,8 +1,8 @@
1
- require_relative 'lib/hexlet/pairs/version'
1
+ require_relative 'lib/pairs/version'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "hexlet-pairs"
5
- spec.version = Hexlet::Pairs::VERSION
5
+ spec.version = Pairs::VERSION
6
6
  spec.authors = ["Hexlet"]
7
7
  spec.email = ["info@hexlet.io"]
8
8
 
@@ -16,10 +16,10 @@ Gem::Specification.new do |spec|
16
16
  spec.metadata["source_code_uri"] = "https://github.com/hexlet-components/ruby-pairs"
17
17
  spec.metadata["changelog_uri"] = "https://github.com/hexlet-components/ruby-pairs"
18
18
 
19
- # Specify which files should be added to the gem when it is released.
20
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
19
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
22
20
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
23
21
  end
22
+ # spec.bindir = "exe"
23
+ # spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
  end
data/lib/pairs.rb ADDED
@@ -0,0 +1,45 @@
1
+ module Pairs
2
+ def self.cons(left, right)
3
+ lambda { |message|
4
+ case message
5
+ when 'car'
6
+ left
7
+ when 'cdr'
8
+ right
9
+ else
10
+ raise "Unknown message #{message}"
11
+ end
12
+ }
13
+ end
14
+
15
+ def self.check_pair(pair)
16
+ return if pair?(pair)
17
+
18
+ raise NoMethodError, pair.to_s
19
+ end
20
+
21
+ def self.car(pair)
22
+ check_pair(pair)
23
+ pair.call('car')
24
+ end
25
+
26
+ def self.cdr(pair)
27
+ pair.call('cdr')
28
+ end
29
+
30
+ def self.pair?(pair)
31
+ pair.instance_of? Proc
32
+ end
33
+
34
+ def self.to_string(pair)
35
+ rec = lambda { |pair_inner|
36
+ return pair_inner.to_s unless pair?(pair_inner)
37
+
38
+ left = car(pair_inner)
39
+ right = cdr(pair_inner)
40
+ "(#{rec.call(left)}, #{rec.call(right)})"
41
+ }
42
+
43
+ rec.call(pair)
44
+ end
45
+ end
@@ -0,0 +1,3 @@
1
+ module Pairs
2
+ VERSION = '1.1.0'.freeze
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hexlet-pairs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hexlet
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-04-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A SICP'ish Functional Pairs implemented in Ruby.
14
14
  email:
@@ -24,9 +24,9 @@ files:
24
24
  - Gemfile.lock
25
25
  - Makefile
26
26
  - README.md
27
- - lib/hexlet/pairs.rb
28
- - lib/hexlet/pairs/version.rb
29
- - pairs.gemspec
27
+ - hexlet-pairs.gemspec
28
+ - lib/pairs.rb
29
+ - lib/pairs/version.rb
30
30
  homepage: https://github.com/hexlet-components/ruby-pairs
31
31
  licenses:
32
32
  - MIT
@@ -34,7 +34,7 @@ metadata:
34
34
  homepage_uri: https://github.com/hexlet-components/ruby-pairs
35
35
  source_code_uri: https://github.com/hexlet-components/ruby-pairs
36
36
  changelog_uri: https://github.com/hexlet-components/ruby-pairs
37
- post_install_message:
37
+ post_install_message:
38
38
  rdoc_options: []
39
39
  require_paths:
40
40
  - lib
@@ -49,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.0.3
53
- signing_key:
52
+ rubygems_version: 3.0.8
53
+ signing_key:
54
54
  specification_version: 4
55
55
  summary: Hexlet Ruby Pairs
56
56
  test_files: []
data/lib/hexlet/pairs.rb DELETED
@@ -1,49 +0,0 @@
1
- require "hexlet/pairs/version"
2
-
3
- module Hexlet
4
- module Pairs
5
- def self.cons(left, right)
6
- lambda { |message|
7
- case message
8
- when 'car'
9
- left
10
- when 'cdr'
11
- right
12
- else
13
- raise "Unknown message #{message}"
14
- end
15
- }
16
- end
17
-
18
- def self.check_pair(pair)
19
- return if pair?(pair)
20
-
21
- raise NoMethodError, pair.to_s
22
- end
23
-
24
- def self.car(pair)
25
- check_pair(pair)
26
- pair.call('car')
27
- end
28
-
29
- def self.cdr(pair)
30
- pair.call('cdr')
31
- end
32
-
33
- def self.pair?(pair)
34
- pair.instance_of? Proc
35
- end
36
-
37
- def self.to_string(pair)
38
- rec = lambda { |pair_inner|
39
- return pair_inner.to_s unless pair?(pair_inner)
40
-
41
- left = car(pair_inner)
42
- right = cdr(pair_inner)
43
- "(#{rec.call(left)}, #{rec.call(right)})"
44
- }
45
-
46
- rec.call(pair)
47
- end
48
- end
49
- end
@@ -1,5 +0,0 @@
1
- module Hexlet
2
- module Pairs
3
- VERSION = "1.0.0"
4
- end
5
- end