ramda-ruby 0.3.0 → 0.4.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: 5069f465457b70d73fdf3293e664aed146961a04
4
- data.tar.gz: d92e10b760d7774df9ae4adfabbb4e16815a9850
3
+ metadata.gz: a24da770e4542e29c54ed754d0320a7a96f5a54f
4
+ data.tar.gz: 8916a3c671a885c61d9f476c50f823c4c9fe5eb7
5
5
  SHA512:
6
- metadata.gz: 51cb3c50f9b3210f0cc362548839746481e14729f8e70b526475148fc0d7454d2be8e65a7a60b7fb8f7449a74d2efa35d85fc504039d99cc0947971754ba691c
7
- data.tar.gz: 9e425cf05c7667634c5e175e46fcb645b0dd7b57ad340c4a30f93bdd9198942c4f1a140aa6a8ebf7a585211b2ff468f575135c56735b9040b5a4cd66ec3bc926
6
+ metadata.gz: 28d4399ce613fabc646e1c2ac23c377079bd248f38a19c5121d7ff0ca3803ef491fce59393a58df8233c8de1bb1e7ec518afdfc287788ae81f31760719c6b7ce
7
+ data.tar.gz: b36333308de88ece376c1f105e4b615a446092b873f2d7aeacf28c4015254decfd62e32fa0334c196f4739529120d882095be2bfc9400448235585f567b4e50a
data/CHANGELOG.md CHANGED
@@ -1,9 +1,20 @@
1
1
  Not Released
2
2
  ---------------
3
3
 
4
+ Release 0.4.0
5
+ ---------------
6
+
7
+ Added:
8
+
9
+ * (pending) to_pairs_in
10
+ * construct_n
11
+ * to_pairs
12
+
4
13
  Release 0.3.0
5
14
  ---------------
6
15
 
16
+ Added:
17
+
7
18
  * (pending) math_mod
8
19
  * ap
9
20
  * chain
data/ROADMAP.md CHANGED
@@ -2,18 +2,6 @@
2
2
 
3
3
  * Find out suitable documentation format
4
4
 
5
- ### release 0.3.0
6
-
7
- ### release 0.4.0
8
-
9
- * construct_n
10
- * to_pairs
11
- * to_pairs_in
12
-
13
- ### release 0.4.2
14
-
15
- * converge
16
-
17
5
  ### release 0.5.0
18
6
 
19
7
  * curry_n
@@ -35,3 +23,37 @@
35
23
  * lift_n
36
24
  * path_eq
37
25
  * replace
26
+
27
+ ### release 0.8.0
28
+
29
+ * assoc
30
+ * assoc_path
31
+ * if_else
32
+ * lens
33
+ * max_by
34
+ * min_by
35
+ * pick_by
36
+ * type
37
+ * unapply
38
+
39
+ ### release 0.9.0
40
+
41
+ * all_pass
42
+ * any_pass
43
+ * call
44
+ * dec
45
+ * drop_while
46
+ * evolve
47
+ * F
48
+ * inc
49
+ * init
50
+ * insert_all
51
+ * invert
52
+ * invert_obj
53
+ * is_nil
54
+ * map_obj_indexed
55
+ * negate
56
+ * nth_arg
57
+ * T
58
+ * to_lower
59
+ * to_upper
data/docs/FUNCTIONS.md CHANGED
@@ -1,3 +1,4 @@
1
+ * (pending) to_pairs_in
1
2
  * (pending) keys_in
2
3
  * (pending) math_mod
3
4
  * (pending) values_in
@@ -19,6 +20,7 @@
19
20
  * compose
20
21
  * concat
21
22
  * construct
23
+ * construct_n
22
24
  * contains
23
25
  * converge
24
26
  * count_by
@@ -110,6 +112,7 @@
110
112
  * tap
111
113
  * times
112
114
  * to_lower
115
+ * to_pairs
113
116
  * to_upper
114
117
  * unary
115
118
  * union
data/lib/ramda.rb CHANGED
@@ -22,6 +22,7 @@ module Ramda
22
22
  :comparator,
23
23
  :compose,
24
24
  :construct,
25
+ :construct_n,
25
26
  :converge,
26
27
  :curry,
27
28
  :empty,
@@ -125,6 +126,8 @@ module Ramda
125
126
  :project,
126
127
  :prop,
127
128
  :props,
129
+ :to_pairs,
130
+ # :to_pairs_in,
128
131
  :values,
129
132
  # :values_in,
130
133
  :where
@@ -3,6 +3,7 @@ require_relative 'internal/function_with_arity'
3
3
 
4
4
  module Ramda
5
5
  # Function functions
6
+ # rubocop:disable Metrics/ModuleLength
6
7
  module Function
7
8
  extend ::Ramda::Internal::CurriedMethod
8
9
 
@@ -76,6 +77,20 @@ module Ramda
76
77
  ->(*args) { constructor.new(*args) }
77
78
  end
78
79
 
80
+ # Wraps a constructor function inside a curried function that can be
81
+ # called with the same arguments and returns the same type. The arity
82
+ # of the function returned is specified to allow using variadic
83
+ # constructor functions.
84
+ #
85
+ # Number -> (* -> {*}) -> (* -> {*})
86
+ #
87
+ curried_method(:construct_n) do |arity, constructor|
88
+ Ramda::Internal::FunctionWithArity
89
+ .new
90
+ .call(arity, &constructor.method(:new))
91
+ .curry
92
+ end
93
+
79
94
  # Accepts a converging function and a list of branching functions and returns
80
95
  # a new function. When invoked, this new function is applied to some arguments,
81
96
  # each branching function is applied to those same arguments. The results of
data/lib/ramda/object.rb CHANGED
@@ -142,6 +142,14 @@ module Ramda
142
142
  keys.map(&obj.method(:[]))
143
143
  end
144
144
 
145
+ # Converts an object into an array of key, value arrays. Only the
146
+ # object's own properties are used. Note that the order of the
147
+ # output array is not guaranteed.
148
+ #
149
+ # {String: *} -> [[String,*]]
150
+ #
151
+ curried_method(:to_pairs, &:to_a)
152
+
145
153
  # Returns a list of all the enumerable own properties of the supplied object.
146
154
  #
147
155
  # {k: v} -> [v]
data/lib/ramda/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ramda
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.4.0'.freeze
3
3
  end
@@ -62,6 +62,22 @@ describe Ramda::Function do
62
62
  end
63
63
  end
64
64
 
65
+ context '#construct_n' do
66
+ it 'from docs' do
67
+ calendar = Class.new do
68
+ attr_reader :days
69
+
70
+ def initialize(*days)
71
+ @days = days
72
+ end
73
+ end
74
+
75
+ callendar_with_three_days = r.construct_n(3, calendar)
76
+
77
+ expect(callendar_with_three_days.call(1).call(2).call(3).days).to eq([1, 2, 3])
78
+ end
79
+ end
80
+
65
81
  context '#converge' do
66
82
  it 'from docs' do
67
83
  average = r.converge(R.divide, [R.sum, R.length])
@@ -130,6 +130,21 @@ describe Ramda::Object do
130
130
  end
131
131
  end
132
132
 
133
+ context '#to_pairs' do
134
+ it 'from docs' do
135
+ expect(r.to_pairs(a: 1, b: 2, c: 3)).to eq([[:a, 1], [:b, 2], [:c, 3]])
136
+ end
137
+ end
138
+
139
+ xcontext '#to_pairs_in' do
140
+ it 'from docs' do
141
+ # var F = function() { this.x = 'X'; };
142
+ # F.prototype.y = 'Y';
143
+ # var f = new F();
144
+ # R.toPairsIn(f); //=> [['x','X'], ['y','Y']]
145
+ end
146
+ end
147
+
133
148
  context '#values' do
134
149
  it 'from docs' do
135
150
  expect(r.values(a: 1, b: 2, c: 3)).to eq([1, 2, 3])
data/spec/ramda_spec.rb CHANGED
@@ -9,6 +9,7 @@ describe Ramda do
9
9
 
10
10
  # r(:keys_in)
11
11
  # r(:math_mod)
12
+ # r(:to_pairs_in)
12
13
  # r(:values_in)
13
14
  r(:add)
14
15
  r(:all)
@@ -28,6 +29,7 @@ describe Ramda do
28
29
  r(:compose)
29
30
  r(:concat)
30
31
  r(:construct)
32
+ r(:construct_n)
31
33
  r(:contains)
32
34
  r(:converge)
33
35
  r(:count_by)
@@ -119,6 +121,7 @@ describe Ramda do
119
121
  r(:tap)
120
122
  r(:times)
121
123
  r(:to_lower)
124
+ r(:to_pairs)
122
125
  r(:to_upper)
123
126
  r(:unary)
124
127
  r(:union)
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.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vadim Lazebny