ramda-ruby 0.4.0 → 0.5.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: a24da770e4542e29c54ed754d0320a7a96f5a54f
4
- data.tar.gz: 8916a3c671a885c61d9f476c50f823c4c9fe5eb7
3
+ metadata.gz: 8b926d96db763d6a43b3d6e114448169ebe87975
4
+ data.tar.gz: aa89681ca4ab9dfb72413e9f21dacbf9ed42a294
5
5
  SHA512:
6
- metadata.gz: 28d4399ce613fabc646e1c2ac23c377079bd248f38a19c5121d7ff0ca3803ef491fce59393a58df8233c8de1bb1e7ec518afdfc287788ae81f31760719c6b7ce
7
- data.tar.gz: b36333308de88ece376c1f105e4b615a446092b873f2d7aeacf28c4015254decfd62e32fa0334c196f4739529120d882095be2bfc9400448235585f567b4e50a
6
+ metadata.gz: 288ef7275478fdd4ed28044dbfafc65ab2e366d988c4e2ce212f99cb1881522c56a9d0a4f0cc233902683c66b211abd141ee8619bf8535441f3f5213eb9aa9f6
7
+ data.tar.gz: b85a150288793a5fa4abe9e3112b2c5f2973614933af18fba0ec272db01ffd25d500f37f6c74665d3d6da3608b54c8aebd8ba743c44a26899fd2706aa96dd314
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  Not Released
2
2
  ---------------
3
3
 
4
+ Release 0.5.0
5
+ ---------------
6
+
7
+ Added:
8
+
9
+ * curry_n
10
+
4
11
  Release 0.4.0
5
12
  ---------------
6
13
 
data/ROADMAP.md CHANGED
@@ -2,10 +2,6 @@
2
2
 
3
3
  * Find out suitable documentation format
4
4
 
5
- ### release 0.5.0
6
-
7
- * curry_n
8
-
9
5
  ### release 0.6.0
10
6
 
11
7
  * __
data/docs/FUNCTIONS.md CHANGED
@@ -25,6 +25,7 @@
25
25
  * converge
26
26
  * count_by
27
27
  * curry
28
+ * curry_n
28
29
  * dec
29
30
  * difference
30
31
  * difference_with
data/lib/ramda.rb CHANGED
@@ -25,6 +25,7 @@ module Ramda
25
25
  :construct_n,
26
26
  :converge,
27
27
  :curry,
28
+ :curry_n,
28
29
  :empty,
29
30
  :flip,
30
31
  :identity,
@@ -119,6 +119,35 @@ module Ramda
119
119
  fn.to_proc.curry
120
120
  end
121
121
 
122
+ # Returns a curried equivalent of the provided function, with the
123
+ # specified arity. The curried function has two unusual capabilities.
124
+ # First, its arguments needn't be provided one at a time.
125
+ # If g is R.curryN(3, f), the following are equivalent:
126
+ #
127
+ # g(1)(2)(3)
128
+ # g(1)(2, 3)
129
+ # g(1, 2)(3)
130
+ # g(1, 2, 3)
131
+ #
132
+ # Secondly, the special placeholder value R.__ may be used to specify
133
+ # "gaps", allowing partial application of any combination of arguments,
134
+ # regardless of their positions.
135
+ # If g is as above and _ is R.__, the following are equivalent:
136
+ #
137
+ # g(1, 2, 3)
138
+ # g(_, 2, 3)(1)
139
+ # g(_, _, 3)(1)(2)
140
+ # g(_, _, 3)(1, 2)
141
+ # g(_, 2)(1)(3)
142
+ # g(_, 2)(1, 3)
143
+ # g(_, 2)(_, 3)(1)
144
+ #
145
+ # Number -> (* -> a) -> (* -> a)
146
+ #
147
+ curried_method(:curry_n) do |arity, fn|
148
+ Ramda::Internal::FunctionWithArity.new.call(arity, &fn).curry
149
+ end
150
+
122
151
  # Returns the empty value of its argument's type. Ramda defines the empty
123
152
  # value of Array ([]), Object ({}), String ('), and Arguments.
124
153
  # Other types are supported if they define <Type>.empty.
data/lib/ramda/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ramda
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -107,6 +107,28 @@ describe Ramda::Function do
107
107
  end
108
108
  end
109
109
 
110
+ context '#curry_n' do
111
+ it 'from docs' do
112
+ sum_args = ->(*args) { R.sum(args) }
113
+
114
+ curried_add_four_numbers = r.curry_n(4, sum_args)
115
+ f = curried_add_four_numbers.call(1, 2)
116
+ g = f.call(3)
117
+
118
+ expect(g.call(4)).to eq(10)
119
+ end
120
+
121
+ xit 'with __' do
122
+ # g(1, 2, 3)
123
+ # g(_, 2, 3)(1)
124
+ # g(_, _, 3)(1)(2)
125
+ # g(_, _, 3)(1, 2)
126
+ # g(_, 2)(1)(3)
127
+ # g(_, 2)(1, 3)
128
+ # g(_, 2)(_, 3)(1)
129
+ end
130
+ end
131
+
110
132
  context '#empty' do
111
133
  it 'from docs' do
112
134
  expect(r.empty([1, 2, 3])).to eq([])
data/spec/ramda_spec.rb CHANGED
@@ -34,6 +34,7 @@ describe Ramda do
34
34
  r(:converge)
35
35
  r(:count_by)
36
36
  r(:curry)
37
+ r(:curry_n)
37
38
  r(:dec)
38
39
  r(:difference)
39
40
  r(:difference_with)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ramda-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Lazebny