fear 3.0.0 → 3.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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +105 -0
  3. data/.simplecov +2 -2
  4. data/.standard.yml +1 -0
  5. data/Gemfile +14 -14
  6. data/Gemfile.lock +56 -37
  7. data/Rakefile +24 -24
  8. data/examples/pattern_extracting.rb +2 -2
  9. data/examples/pattern_matching_number_in_words.rb +12 -12
  10. data/fear.gemspec +2 -3
  11. data/lib/fear/either/left_projection.rb +5 -5
  12. data/lib/fear/either/pattern_match.rb +2 -2
  13. data/lib/fear/either.rb +1 -1
  14. data/lib/fear/empty_partial_function.rb +2 -2
  15. data/lib/fear/failure.rb +4 -4
  16. data/lib/fear/for.rb +1 -1
  17. data/lib/fear/for_api.rb +1 -1
  18. data/lib/fear/future.rb +5 -5
  19. data/lib/fear/left/pattern_match.rb +1 -1
  20. data/lib/fear/left.rb +3 -3
  21. data/lib/fear/none_class.rb +2 -2
  22. data/lib/fear/option.rb +1 -1
  23. data/lib/fear/partial_function/and_then.rb +2 -2
  24. data/lib/fear/partial_function/combined.rb +3 -3
  25. data/lib/fear/partial_function/or_else.rb +2 -2
  26. data/lib/fear/partial_function_class.rb +1 -1
  27. data/lib/fear/pattern_match.rb +2 -2
  28. data/lib/fear/pattern_matching_api.rb +1 -1
  29. data/lib/fear/right/pattern_match.rb +1 -1
  30. data/lib/fear/right.rb +3 -3
  31. data/lib/fear/right_biased.rb +2 -2
  32. data/lib/fear/some.rb +2 -2
  33. data/lib/fear/success.rb +4 -4
  34. data/lib/fear/try_api.rb +1 -1
  35. data/lib/fear/utils.rb +1 -1
  36. data/lib/fear/version.rb +1 -1
  37. data/spec/fear/either/pattern_match_spec.rb +6 -6
  38. data/spec/fear/either_spec.rb +1 -1
  39. data/spec/fear/left_spec.rb +1 -1
  40. data/spec/fear/option/pattern_match_spec.rb +5 -5
  41. data/spec/fear/option_spec.rb +2 -2
  42. data/spec/fear/partial_function/any_spec.rb +3 -3
  43. data/spec/fear/partial_function/empty_spec.rb +1 -1
  44. data/spec/fear/partial_function_and_then_spec.rb +5 -5
  45. data/spec/fear/partial_function_composition_spec.rb +6 -6
  46. data/spec/fear/partial_function_or_else_spec.rb +13 -13
  47. data/spec/fear/partial_function_spec.rb +7 -7
  48. data/spec/fear/pattern_match_spec.rb +5 -5
  49. data/spec/fear/right_spec.rb +1 -1
  50. data/spec/fear/try/try_pattern_match_spec.rb +6 -6
  51. data/spec/fear/try_api_spec.rb +2 -2
  52. data/spec/fear/utils_spec.rb +3 -3
  53. metadata +7 -50
  54. data/.github/workflows/rubocop.yml +0 -39
  55. data/.github/workflows/spec.yml +0 -39
  56. data/.rubocop.yml +0 -7
@@ -76,7 +76,7 @@ RSpec.describe Fear::Right do
76
76
  subject do
77
77
  right.reduce(
78
78
  ->(left) { "Left: #{left}" },
79
- ->(right) { "Right: #{right}" },
79
+ ->(right) { "Right: #{right}" }
80
80
  )
81
81
  end
82
82
 
@@ -10,10 +10,10 @@ RSpec.describe Fear::Try::PatternMatch do
10
10
  end
11
11
 
12
12
  it do
13
- expect(matcher.(Fear.success(4))).to eq("4 is even")
14
- expect(matcher.(Fear.success(3))).to eq("3 is odd")
13
+ expect(matcher.call(Fear.success(4))).to eq("4 is even")
14
+ expect(matcher.call(Fear.success(3))).to eq("3 is odd")
15
15
  expect do
16
- matcher.(Fear.failure(RuntimeError.new))
16
+ matcher.call(Fear.failure(RuntimeError.new))
17
17
  end.to raise_error(Fear::MatchError)
18
18
  end
19
19
  end
@@ -27,10 +27,10 @@ RSpec.describe Fear::Try::PatternMatch do
27
27
  end
28
28
 
29
29
  it do
30
- expect(matcher.(Fear.failure(RuntimeError.new))).to eq("RuntimeError is first")
31
- expect(matcher.(Fear.failure(StandardError.new))).to eq("StandardError is second")
30
+ expect(matcher.call(Fear.failure(RuntimeError.new))).to eq("RuntimeError is first")
31
+ expect(matcher.call(Fear.failure(StandardError.new))).to eq("StandardError is second")
32
32
  expect do
33
- matcher.(Fear.success(44))
33
+ matcher.call(Fear.success(44))
34
34
  end.to raise_error(Fear::MatchError)
35
35
  end
36
36
  end
@@ -15,9 +15,9 @@ RSpec.describe Fear::TryApi do
15
15
  end
16
16
 
17
17
  context "when low level error happened" do
18
- subject(:try) { Fear.try { raise Exception } }
18
+ subject(:try) { Fear.try { raise NoMemoryError } }
19
19
 
20
- it { expect { try }.to raise_error(Exception) }
20
+ it { expect { try }.to raise_error(NoMemoryError) }
21
21
  end
22
22
  end
23
23
  end
@@ -24,7 +24,7 @@ RSpec.describe Fear::Utils do
24
24
  it "fails with argument error" do
25
25
  is_expected.to raise_error(
26
26
  ArgumentError,
27
- "#the_method accepts either one argument or block",
27
+ "#the_method accepts either one argument or block"
28
28
  )
29
29
  end
30
30
  end
@@ -35,7 +35,7 @@ RSpec.describe Fear::Utils do
35
35
  it "fails with argument error" do
36
36
  is_expected.to raise_error(
37
37
  ArgumentError,
38
- "#the_method accepts either one argument or block",
38
+ "#the_method accepts either one argument or block"
39
39
  )
40
40
  end
41
41
  end
@@ -54,7 +54,7 @@ RSpec.describe Fear::Utils do
54
54
  it "raises TypeError" do
55
55
  is_expected.to raise_error(
56
56
  TypeError,
57
- "expected `24` to be of String class",
57
+ "expected `24` to be of String class"
58
58
  )
59
59
  end
60
60
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fear
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tëma Bolshakov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-04-02 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: zeitwerk
@@ -32,12 +31,11 @@ extensions: []
32
31
  extra_rdoc_files: []
33
32
  files:
34
33
  - ".github/dependabot.yml"
35
- - ".github/workflows/rubocop.yml"
36
- - ".github/workflows/spec.yml"
34
+ - ".github/workflows/ci.yml"
37
35
  - ".gitignore"
38
36
  - ".rspec"
39
- - ".rubocop.yml"
40
37
  - ".simplecov"
38
+ - ".standard.yml"
41
39
  - ".yardopts"
42
40
  - CHANGELOG.md
43
41
  - Gemfile
@@ -151,7 +149,6 @@ homepage: https://github.com/bolshakov/fear
151
149
  licenses:
152
150
  - MIT
153
151
  metadata: {}
154
- post_install_message:
155
152
  rdoc_options: []
156
153
  require_paths:
157
154
  - lib
@@ -159,54 +156,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
156
  requirements:
160
157
  - - ">="
161
158
  - !ruby/object:Gem::Version
162
- version: '3.1'
159
+ version: '3.2'
163
160
  required_rubygems_version: !ruby/object:Gem::Requirement
164
161
  requirements:
165
162
  - - ">="
166
163
  - !ruby/object:Gem::Version
167
164
  version: '0'
168
165
  requirements: []
169
- rubygems_version: 3.5.7
170
- signing_key:
166
+ rubygems_version: 3.6.9
171
167
  specification_version: 4
172
168
  summary: "%q{Ruby port of some Scala's monads.}"
173
- test_files:
174
- - spec/fear/awaitable_spec.rb
175
- - spec/fear/done_spec.rb
176
- - spec/fear/either/left_projection_spec.rb
177
- - spec/fear/either/mixin_spec.rb
178
- - spec/fear/either/pattern_match_spec.rb
179
- - spec/fear/either_pattern_matching_spec.rb
180
- - spec/fear/either_spec.rb
181
- - spec/fear/failure_spec.rb
182
- - spec/fear/for/mixin_spec.rb
183
- - spec/fear/for_spec.rb
184
- - spec/fear/future_spec.rb
185
- - spec/fear/guard_spec.rb
186
- - spec/fear/left_spec.rb
187
- - spec/fear/none_spec.rb
188
- - spec/fear/option/mixin_spec.rb
189
- - spec/fear/option/pattern_match_spec.rb
190
- - spec/fear/option_pattern_matching_spec.rb
191
- - spec/fear/option_spec.rb
192
- - spec/fear/partial_function/any_spec.rb
193
- - spec/fear/partial_function/empty_spec.rb
194
- - spec/fear/partial_function_and_then_spec.rb
195
- - spec/fear/partial_function_composition_spec.rb
196
- - spec/fear/partial_function_or_else_spec.rb
197
- - spec/fear/partial_function_spec.rb
198
- - spec/fear/pattern_match_spec.rb
199
- - spec/fear/pattern_matching_api_spec.rb
200
- - spec/fear/promise_spec.rb
201
- - spec/fear/right_biased/left.rb
202
- - spec/fear/right_biased/right.rb
203
- - spec/fear/right_spec.rb
204
- - spec/fear/some_spec.rb
205
- - spec/fear/success_spec.rb
206
- - spec/fear/try/mixin_spec.rb
207
- - spec/fear/try/try_pattern_match_spec.rb
208
- - spec/fear/try_api_spec.rb
209
- - spec/fear/try_pattern_matching_spec.rb
210
- - spec/fear/utils_spec.rb
211
- - spec/spec_helper.rb
212
- - spec/support/.keep
169
+ test_files: []
@@ -1,39 +0,0 @@
1
- # pulled from repo
2
- name: "Rubocop"
3
-
4
- on: pull_request
5
-
6
- jobs:
7
- rubocop:
8
- runs-on: ubuntu-latest
9
- strategy:
10
- fail-fast: false
11
-
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v2
15
-
16
- # If running on a self-hosted runner, check it meets the requirements
17
- # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners
18
- - name: Set up Ruby
19
- uses: ruby/setup-ruby@v1
20
- with:
21
- ruby-version: 3.1
22
-
23
- # This step is not necessary if you add the gem to your Gemfile
24
- - name: Install Code Scanning integration
25
- run: bundle add code-scanning-rubocop --version 0.4.0 --skip-install
26
-
27
- - name: Install dependencies
28
- run: bundle install
29
-
30
- - name: Rubocop run
31
- run: |
32
- bash -c "
33
- bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
34
- [[ $? -ne 2 ]]
35
- "
36
- - name: Upload Sarif output
37
- uses: github/codeql-action/upload-sarif@v1
38
- with:
39
- sarif_file: rubocop.sarif
@@ -1,39 +0,0 @@
1
- name: Spec
2
-
3
- on: [push]
4
-
5
- jobs:
6
- test:
7
- runs-on: ubuntu-latest
8
- strategy:
9
- matrix:
10
- ruby: ['3.1', "3.2", "3.3", "truffleruby+graalvm-head"]
11
- name: ${{ matrix.ruby }}
12
-
13
- steps:
14
- - uses: actions/checkout@v1
15
- - name: Set up ruby
16
- uses: ruby/setup-ruby@v1
17
- with:
18
- ruby-version: ${{ matrix.ruby }}
19
- - name: Install dependencies
20
- run: bundle install
21
- - name: Test
22
- run: bundle exec rspec
23
- - name: Coveralls
24
- uses: coverallsapp/github-action@v1.1.2
25
- with:
26
- github-token: ${{ secrets.GITHUB_TOKEN }}
27
- flag-name: ruby-${{ matrix.ruby }}
28
- parallel: true
29
-
30
-
31
- finish:
32
- needs: test
33
- runs-on: ubuntu-latest
34
- steps:
35
- - name: Coveralls Finished
36
- uses: coverallsapp/github-action@master
37
- with:
38
- github-token: ${{ secrets.GITHUB_TOKEN }}
39
- parallel-finished: true
data/.rubocop.yml DELETED
@@ -1,7 +0,0 @@
1
- inherit_gem:
2
- ruby_coding_standard: .rubocop.yml
3
-
4
- AllCops:
5
- TargetRubyVersion: 2.7
6
- Exclude:
7
- - vendor/**/*