blood_contracts-ext 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7753da5bf340600c41348deca62452860ac5663eb238470f5f2af67f72d162e
4
- data.tar.gz: a11f44add5d39132210250f8732e23818abaafebdd0558fcfd2eea3084c4f70b
3
+ metadata.gz: f6c41d868275bec56ce3e23362086fea4e6760367ed16b6a2df5edf45a0fb81a
4
+ data.tar.gz: 8876480c1475350dca5bfde8e66946259e1fd32bbe68757c45fa989e99ef59fb
5
5
  SHA512:
6
- metadata.gz: d7e28da298037135f8baa122ec04968f2b70137e0379afee26421a744a08b92c1faa8ce224cf2dd2c0fb53a8ebdaf956937c4d17402fa99e704af6901b368328
7
- data.tar.gz: a5796575eb357fd0c5753906ebf29e1410372c8ee451165aec8ce070118bcac65b014de53a41f6a005fdcede76a997a45c38b44e39da01358eaca20b21a8d6f1
6
+ metadata.gz: caa86fd2ae88b06a99017f7cef51a65a10f268ae53d885bdd34a24bdcdc7e83ea0ef7fe33ff62d83eb932ee60e29136e23107024148e8aa6f7ab63107d75e22f
7
+ data.tar.gz: 87831dc33a43ef69afa0a76e12e13e30aa63a222e39e0426360aef414610b649da9b1602a8b819a8d9026aa3b98d678c57b0b6210d0ae2995a2949a8e4c5adc8
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
7
7
 
8
+ ## [0.1.1] - [2018-07-10]
9
+
10
+ ### Fixes:
11
+ Aliases for `#or_a` and `#and_then` didn't work well for BC::Ext::Refined
12
+
8
13
  ## [0.1.0] - [2019-07-04]
9
14
 
10
15
  This is a first public release marked in change log with features extracted from production app.
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "blood_contracts-ext"
3
- gem.version = "0.1.0"
3
+ gem.version = "0.1.1"
4
4
  gem.authors = ["Sergey Dolganov (sclinede)"]
5
5
  gem.email = ["sclinede@evilmartians.com"]
6
6
 
@@ -28,6 +28,8 @@ module BloodContracts::Core
28
28
 
29
29
  # @private
30
30
  private def underscore(string)
31
+ return string.underscore if string.respond_to?(:underscore)
32
+
31
33
  string.gsub(/([A-Z]+)([A-Z])/, '\1_\2')
32
34
  .gsub(/([a-z])([A-Z])/, '\1_\2')
33
35
  .gsub("__", "/")
@@ -6,7 +6,7 @@ module BloodContracts::Core
6
6
  # @param value [Exception] value which is wrapped inside the type
7
7
  # @option context [Hash] shared context of types matching pipeline
8
8
  #
9
- def initialize(value = nil, context: Hash.new { |h, k| h[k] = {} }, **)
9
+ def initialize(value = nil, context: {}, **)
10
10
  @errors = []
11
11
  @context = context
12
12
  @value = value
@@ -27,6 +27,14 @@ module BloodContracts::Core
27
27
  BC::Ext::Sum.new(self, other_type)
28
28
  end
29
29
 
30
+ # Alias for Sum compose
31
+ # See #or_a
32
+ alias or_an or_a
33
+
34
+ # Alias for Sum compose
35
+ # See #or_a
36
+ alias | or_a
37
+
30
38
  # Compose types in a Pipe check
31
39
  # Pipe passes data from type to type sequentially
32
40
  #
@@ -36,6 +44,10 @@ module BloodContracts::Core
36
44
  BC::Ext::Pipe.new(self, other_type)
37
45
  end
38
46
 
47
+ # Alias for Pipe compose
48
+ # See #and_then
49
+ alias > and_then
50
+
39
51
  # @private
40
52
  def inherited(new_klass)
41
53
  new_klass.failure_klass ||= failure_klass
@@ -60,7 +60,6 @@ RSpec.describe "BC::Ext::Refined validation delegated to Tram::Policy" do
60
60
  private def stringify_hash_keys(hash)
61
61
  hash.reduce({}) { |a, (k, v)| a.merge!(k.to_s => v) }
62
62
  end
63
-
64
63
  end
65
64
 
66
65
  Address = Struct.new(:country, :city, :street)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blood_contracts-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Dolganov (sclinede)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-04 00:00:00.000000000 Z
11
+ date: 2019-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: blood_contracts-core