fear 0.8.0 → 0.9.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
  SHA1:
3
- metadata.gz: 411515ace8057ec8c729af78695f68f9725b1e85
4
- data.tar.gz: 950037cd612263f215aba321571a16aa748a182d
3
+ metadata.gz: 4f87d9ddc3fd6c7bdd259ed164ca27668c3421f1
4
+ data.tar.gz: f1cd2982080e8b8f302be524f55ef18f9406b3e6
5
5
  SHA512:
6
- metadata.gz: 45f9c7492bf76cb010f74e915f1f0537709c033200198d59c9ac04329e6285e8c098cd1f738ff2c03d676ef60602d285db2420868d1630711053f3135bdebae4
7
- data.tar.gz: d0fa4e5806640803d6fd46c6ee1954c1910b557985ea17b61edab3c27d95a343ae7b754aa2e982cd58b164b13f77bbc632e60c20acc55bfecf00e6a7c4c8614f
6
+ metadata.gz: 18926b68929c6b68b8e7e3fe1f5352a2998dade76e1860097b470a93e7d236142a84b1cf98a2413b6b093dd412461bc5fa764f10a3753cf932ab0558d8d59d9e
7
+ data.tar.gz: 95c5eecb1b37444c63fdf713bcee58306053ba5708b10b4c7f6d4fa4dd53804143bc321cb5b10927297f136951d83573d9924086b6faa0794a239513603b12c3
data/.travis.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.5
3
+ - 2.3.7
4
+ - 2.4.4
5
+ - 2.5.1
4
6
  script:
5
7
  - rubocop -D
6
8
  - bundle exec rspec spec
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.9.0
2
+
3
+ * Test against last supported ruby versions: 2.3.7, 2.4.4, 2.5.1 ([@bolshakov][])
4
+ * Make possible to pass to `#get_or_else` nil and false values ([@bolshakov][])
5
+
1
6
  ## 0.8.0
2
7
 
3
8
  * Add `Fear::Done` to represent successful completion without a value. ([@bolshakov][])
data/README.md CHANGED
@@ -103,8 +103,8 @@ end
103
103
 
104
104
  puts(
105
105
  result.reduce(
106
- -> (x) { "You passed me the Int: #{x}, which I will increment. #{x} + 1 = #{x+1}" },
107
- -> (x) { "You passed me the String: #{x}" }
106
+ -> (x) { "You passed me the String: #{x}" },
107
+ -> (x) { "You passed me the Int: #{x}, which I will increment. #{x} + 1 = #{x+1}" }
108
108
  )
109
109
  )
110
110
  ```
data/lib/fear/either.rb CHANGED
@@ -21,8 +21,8 @@ module Fear
21
21
  #
22
22
  # puts(
23
23
  # result.reduce(
24
- # -> (x) { "You passed me the Int: #{x}, which I will increment. #{x} + 1 = #{x+1}" },
25
- # -> (x) { "You passed me the String: #{x}" }
24
+ # -> (x) { "You passed me the String: #{x}" },
25
+ # -> (x) { "You passed me the Int: #{x}, which I will increment. #{x} + 1 = #{x+1}" }
26
26
  # )
27
27
  # )
28
28
  #
data/lib/fear/utils.rb CHANGED
@@ -4,7 +4,7 @@ module Fear
4
4
  extend self
5
5
 
6
6
  def assert_arg_or_block!(method_name, *args)
7
- unless block_given? ^ args.any?
7
+ unless block_given? ^ !args.empty?
8
8
  fail ArgumentError, "##{method_name} accepts either one argument or block"
9
9
  end
10
10
  end
data/lib/fear/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Fear
2
- VERSION = '0.8.0'.freeze
2
+ VERSION = '0.9.0'.freeze
3
3
  end
@@ -20,6 +20,22 @@ RSpec.shared_examples Fear::RightBiased::Left do
20
20
  is_expected.to eq('default')
21
21
  end
22
22
  end
23
+
24
+ context 'with false argument' do
25
+ subject { left.get_or_else(false) }
26
+
27
+ it 'returns default value' do
28
+ is_expected.to eq(false)
29
+ end
30
+ end
31
+
32
+ context 'with nil argument' do
33
+ subject { left.get_or_else(nil) }
34
+
35
+ it 'returns default value' do
36
+ is_expected.to eq(nil)
37
+ end
38
+ end
23
39
  end
24
40
 
25
41
  describe '#each' do
@@ -27,6 +27,22 @@ RSpec.shared_examples Fear::RightBiased::Right do
27
27
  is_expected.to eq('value')
28
28
  end
29
29
  end
30
+
31
+ context 'with false argument' do
32
+ subject { right.get_or_else(false) }
33
+
34
+ it 'returns value' do
35
+ is_expected.to eq('value')
36
+ end
37
+ end
38
+
39
+ context 'with nil argument' do
40
+ subject { right.get_or_else(nil) }
41
+
42
+ it 'returns value' do
43
+ is_expected.to eq('value')
44
+ end
45
+ end
30
46
  end
31
47
 
32
48
  describe '#each' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fear
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tema Bolshakov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-23 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-equalizer
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
- rubygems_version: 2.5.2.1
192
+ rubygems_version: 2.6.11
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: "%q{Ruby port of some Scala's monads.}"