ramda-ruby 0.1.0 → 0.1.1
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 +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +15 -19
- data/ROADMAP.md +77 -8
- data/docs/FUNCTIONS.md +3 -0
- data/lib/ramda.rb +13 -1
- data/lib/ramda/list.rb +51 -6
- data/lib/ramda/logic.rb +14 -0
- data/lib/ramda/math.rb +8 -0
- data/lib/ramda/object.rb +15 -0
- data/lib/ramda/type.rb +11 -0
- data/lib/ramda/version.rb +1 -1
- data/spec/ramda/list_spec.rb +47 -2
- data/spec/ramda/logic_spec.rb +10 -0
- data/spec/ramda/math_spec.rb +9 -0
- data/spec/ramda/object_spec.rb +15 -0
- data/spec/ramda_spec.rb +9 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c368ef74f40f78f3e1d67b6663e30e664fedcadb
|
4
|
+
data.tar.gz: 0c811702973651568960f00b3308b727bd839895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bc8bf53712b35c48a2eaf056cf166cfd1a7ec8b3b84ef1eed944dfa9f5e75d48834b28d14c3fc0e6a23d2521e3c586f257e7ab100e39e729b846d8c925f4043
|
7
|
+
data.tar.gz: 2536d9295955f1f80f1f86254d6a7969b4d02b5ed7e3a55c810a7fff45d89660211536c184e60d267eceaa4c9b6cefdc01757f4dfda527a7af51e2f5d83db589
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
Not Released
|
2
|
+
---------------
|
3
|
+
|
4
|
+
Release 0.1.1
|
5
|
+
---------------
|
6
|
+
|
7
|
+
Breaking changes: index_of, last_index_of return nil instead of -1 if element can't be found
|
8
|
+
|
9
|
+
Added:
|
10
|
+
|
11
|
+
* find_index
|
12
|
+
* find_last
|
13
|
+
* find_last_index
|
14
|
+
* for_each
|
15
|
+
* modulo
|
16
|
+
* repeat
|
17
|
+
* where
|
18
|
+
|
1
19
|
Release 0.1.0
|
2
20
|
---------------
|
3
21
|
Added functions from Ramda Js v0.1.0
|
data/README.md
CHANGED
@@ -36,27 +36,12 @@ And then require:
|
|
36
36
|
require 'ramda'
|
37
37
|
```
|
38
38
|
|
39
|
-
## Philosophy of [Ramda](http://ramdajs.com)
|
40
|
-
|
41
|
-
* Ramda emphasizes a purer functional style.
|
42
|
-
Immutability and side-effect free functions are at the heart of its design philosophy.
|
43
|
-
This can help you get the job done with simple, elegant code.
|
44
|
-
|
45
|
-
* Ramda functions are automatically curried.
|
46
|
-
This allows you to easily build up new functions from old ones simply by not supplying the final parameters.
|
47
|
-
|
48
|
-
* The parameters to Ramda functions are arranged to make it convenient for currying.
|
49
|
-
The data to be operated on is generally supplied last.
|
50
|
-
|
51
|
-
|
52
39
|
## Documentation
|
53
40
|
|
54
|
-
|
41
|
+
Currently the gem doesn't have own documentation but it tries to follow specification from [Ramda Js](http://ramdajs.com/docs/)
|
55
42
|
|
56
|
-
|
57
|
-
|
58
|
-
* each release contains [functions](docs/FUNCTIONS.md) from the relevant Ramda Js release
|
59
|
-
* each release includes more functions which i found pretty useful
|
43
|
+
* each release includes [functions](docs/FUNCTIONS.md) from the relevant [Ramda Js](http://ramdajs.com) release
|
44
|
+
* each release includes more functions which i found pretty useful but they are from upcoming releases
|
60
45
|
|
61
46
|
You could use [Ramda Js](http://ramdajs.com/docs/) as a source of documentation.
|
62
47
|
|
@@ -64,7 +49,18 @@ Ruby scpecific examples can be found in [tests](spec/ramda).
|
|
64
49
|
|
65
50
|
## Usage
|
66
51
|
|
67
|
-
|
52
|
+
```ruby
|
53
|
+
R = Ramda
|
54
|
+
|
55
|
+
players = [
|
56
|
+
{ name: 'Andrey', score: 100 },
|
57
|
+
{ name: 'Ivan', score: 200 },
|
58
|
+
{ name: 'Masha', score: 150 }
|
59
|
+
]
|
60
|
+
|
61
|
+
best_player = R.pipe(R.sort_by(R.prop(:score)), R.reverse, R.head, R.prop(:name))
|
62
|
+
best_player.call(players) # Ivan
|
63
|
+
```
|
68
64
|
|
69
65
|
## Development
|
70
66
|
|
data/ROADMAP.md
CHANGED
@@ -1,14 +1,83 @@
|
|
1
|
-
### Add
|
1
|
+
### Add documentation
|
2
2
|
|
3
|
-
### Add documentation ###
|
4
|
-
|
5
|
-
* Get in touch with Ramdajs authors
|
6
3
|
* Find out suitable documentation format
|
7
4
|
|
8
|
-
|
5
|
+
#### release 0.1.1
|
6
|
+
|
7
|
+
* find_index
|
8
|
+
* find_last
|
9
|
+
* find_last_index
|
10
|
+
* for_each
|
11
|
+
* modulo
|
12
|
+
* repeat
|
13
|
+
* where
|
14
|
+
|
15
|
+
#### release 0.1.4
|
16
|
+
|
17
|
+
last
|
18
|
+
partition
|
19
|
+
slice
|
20
|
+
|
21
|
+
### release 0.2.0
|
22
|
+
|
23
|
+
binary
|
24
|
+
keys_in
|
25
|
+
path
|
26
|
+
unary
|
27
|
+
uniq_with
|
28
|
+
values_in
|
29
|
+
|
30
|
+
### release 0.2.2
|
31
|
+
|
32
|
+
insert
|
33
|
+
remove
|
34
|
+
|
35
|
+
### release 0.2.3
|
36
|
+
|
37
|
+
times
|
38
|
+
|
39
|
+
### release 0.3.0
|
40
|
+
|
41
|
+
ap
|
42
|
+
chain
|
43
|
+
empty
|
44
|
+
from_pairs
|
45
|
+
is
|
46
|
+
length
|
47
|
+
math_mod
|
48
|
+
of
|
49
|
+
unnest
|
50
|
+
zip_obj
|
51
|
+
|
52
|
+
### release 0.4.0
|
53
|
+
|
54
|
+
construct_n
|
55
|
+
to_pairs
|
56
|
+
to_pairs_in
|
57
|
+
|
58
|
+
### release 0.4.2
|
59
|
+
|
60
|
+
converge
|
61
|
+
|
62
|
+
### release 0.5.0
|
63
|
+
|
64
|
+
curry_n
|
65
|
+
|
66
|
+
### release 0.6.0
|
67
|
+
|
68
|
+
__
|
69
|
+
bind
|
70
|
+
cond
|
71
|
+
prop_or
|
72
|
+
trim
|
9
73
|
|
10
|
-
###
|
74
|
+
### release 0.7.0
|
11
75
|
|
12
|
-
|
76
|
+
apply
|
77
|
+
has
|
78
|
+
has_in
|
79
|
+
lift
|
80
|
+
lift_n
|
81
|
+
path_eq
|
82
|
+
replace
|
13
83
|
|
14
|
-
### Prepare 0.1.0 Release ###
|
data/docs/FUNCTIONS.md
CHANGED
data/lib/ramda.rb
CHANGED
@@ -8,6 +8,7 @@ require 'ramda/math'
|
|
8
8
|
require 'ramda/object'
|
9
9
|
require 'ramda/relation'
|
10
10
|
require 'ramda/string'
|
11
|
+
require 'ramda/type'
|
11
12
|
|
12
13
|
# Ramda library implementation, source: http://ramdajs.com/
|
13
14
|
# rubocop:disable Metrics/ModuleLength
|
@@ -40,7 +41,11 @@ module Ramda
|
|
40
41
|
:drop,
|
41
42
|
:filter,
|
42
43
|
:find,
|
44
|
+
:find_index,
|
45
|
+
:find_last,
|
46
|
+
:find_last_index,
|
43
47
|
:flatten,
|
48
|
+
:for_each,
|
44
49
|
:group_by,
|
45
50
|
:head,
|
46
51
|
:index_of,
|
@@ -56,6 +61,7 @@ module Ramda
|
|
56
61
|
:reduce,
|
57
62
|
:reduce_right,
|
58
63
|
:reject,
|
64
|
+
:repeat,
|
59
65
|
:reverse,
|
60
66
|
:tail,
|
61
67
|
:take,
|
@@ -69,6 +75,7 @@ module Ramda
|
|
69
75
|
:all_pass,
|
70
76
|
:and,
|
71
77
|
:any_pass,
|
78
|
+
# :complement,
|
72
79
|
:if_else,
|
73
80
|
:is_empty,
|
74
81
|
:not,
|
@@ -79,6 +86,7 @@ module Ramda
|
|
79
86
|
:dec,
|
80
87
|
:divide,
|
81
88
|
:inc,
|
89
|
+
:modulo,
|
82
90
|
:multiply,
|
83
91
|
:product,
|
84
92
|
:subtract,
|
@@ -97,7 +105,8 @@ module Ramda
|
|
97
105
|
:project,
|
98
106
|
:prop,
|
99
107
|
:props,
|
100
|
-
:values
|
108
|
+
:values,
|
109
|
+
:where
|
101
110
|
|
102
111
|
def_delegators Ramda::Relation,
|
103
112
|
:count_by,
|
@@ -122,4 +131,7 @@ module Ramda
|
|
122
131
|
:split,
|
123
132
|
:to_lower,
|
124
133
|
:to_upper
|
134
|
+
|
135
|
+
def_delegators Ramda::Type,
|
136
|
+
:is_nil
|
125
137
|
end
|
data/lib/ramda/list.rb
CHANGED
@@ -105,6 +105,34 @@ module Ramda
|
|
105
105
|
xs.find(&f)
|
106
106
|
end
|
107
107
|
|
108
|
+
# Returns the index of the first element of the list which matches the predicate,
|
109
|
+
# or nil if no element matches.
|
110
|
+
#
|
111
|
+
# (a -> Boolean) -> [a] -> Number | NilClass
|
112
|
+
#
|
113
|
+
curried_method(:find_index) do |fn, xs|
|
114
|
+
xs.index(&fn)
|
115
|
+
end
|
116
|
+
|
117
|
+
# Returns the last element of the list which matches the predicate,
|
118
|
+
# or nil if no element matches.
|
119
|
+
#
|
120
|
+
# (a -> Boolean) -> [a] -> a | NilClass
|
121
|
+
#
|
122
|
+
curried_method(:find_last) do |fn, xs|
|
123
|
+
index = xs.rindex(&fn)
|
124
|
+
xs[index] unless index.nil?
|
125
|
+
end
|
126
|
+
|
127
|
+
# Returns the index of the last element of the list which matches the
|
128
|
+
# predicate, or nil if no element matches.
|
129
|
+
#
|
130
|
+
# (a -> Boolean) -> [a] -> Number | NilClass
|
131
|
+
#
|
132
|
+
curried_method(:find_last_index) do |fn, xs|
|
133
|
+
xs.rindex(&fn)
|
134
|
+
end
|
135
|
+
|
108
136
|
# Returns a new list by pulling every item out of it (and all its sub-arrays)
|
109
137
|
# and putting them in a new array, depth-first.
|
110
138
|
#
|
@@ -112,6 +140,15 @@ module Ramda
|
|
112
140
|
#
|
113
141
|
curried_method(:flatten, &:flatten)
|
114
142
|
|
143
|
+
# Iterate over an input list, calling a provided function fn for each element
|
144
|
+
# in the list.
|
145
|
+
#
|
146
|
+
# (a -> *) -> [a] -> [a]
|
147
|
+
#
|
148
|
+
curried_method(:for_each) do |fn, xs|
|
149
|
+
xs.each(&fn)
|
150
|
+
end
|
151
|
+
|
115
152
|
# Splits a list into sub-lists stored in an object, based on the result of
|
116
153
|
# calling a String-returning function on each element, and grouping the
|
117
154
|
# results according to values returned.
|
@@ -138,12 +175,12 @@ module Ramda
|
|
138
175
|
end
|
139
176
|
|
140
177
|
# Returns the position of the first occurrence of an item in an array,
|
141
|
-
# or
|
178
|
+
# or nil if the item is not included in the array.
|
142
179
|
#
|
143
|
-
# a -> [a] -> Number
|
180
|
+
# a -> [a] -> Number | NilClass
|
144
181
|
#
|
145
182
|
curried_method(:index_of) do |x, xs|
|
146
|
-
xs.index(x)
|
183
|
+
xs.index(x)
|
147
184
|
end
|
148
185
|
|
149
186
|
# Returns a string made by inserting the separator between each element and
|
@@ -156,12 +193,12 @@ module Ramda
|
|
156
193
|
end
|
157
194
|
|
158
195
|
# Returns the position of the last occurrence of an item in an array,
|
159
|
-
# or
|
196
|
+
# or nil if the item is not included in the array.
|
160
197
|
#
|
161
|
-
# a -> [a] -> Number
|
198
|
+
# a -> [a] -> Number | NilClass
|
162
199
|
#
|
163
200
|
curried_method(:last_index_of) do |x, xs|
|
164
|
-
xs.rindex(x)
|
201
|
+
xs.rindex(x)
|
165
202
|
end
|
166
203
|
|
167
204
|
# Returns the number of elements in the array by returning list.length
|
@@ -287,6 +324,14 @@ module Ramda
|
|
287
324
|
end
|
288
325
|
end
|
289
326
|
|
327
|
+
# Returns a fixed list of size n containing a specified identical value.
|
328
|
+
#
|
329
|
+
# a -> n -> [a]
|
330
|
+
#
|
331
|
+
curried_method(:repeat) do |a, n|
|
332
|
+
Array.new(n, a)
|
333
|
+
end
|
334
|
+
|
290
335
|
# Returns a copy of the list, sorted according to the comparator function,
|
291
336
|
# which should accept two values at a time and return a negative number
|
292
337
|
# if the first value is smaller, a positive number if it's larger, and
|
data/lib/ramda/logic.rb
CHANGED
@@ -17,6 +17,20 @@ module Ramda
|
|
17
17
|
predicates.any? { |predicate| predicate.call(obj) }
|
18
18
|
end
|
19
19
|
|
20
|
+
# Takes a function f and returns a function g such that if called with
|
21
|
+
# the same arguments when f returns a "truthy" value, g returns false
|
22
|
+
# and when f returns a "falsy" value g returns true.
|
23
|
+
#
|
24
|
+
# R.complement may be applied to any functor
|
25
|
+
#
|
26
|
+
# (*... -> *) -> (*... -> Boolean)
|
27
|
+
#
|
28
|
+
curried_method(:complement) do |fn|
|
29
|
+
::Ramda::Internal::FunctionWithArity.new.call(fn.arity) do |*args|
|
30
|
+
!fn.call(*args)
|
31
|
+
end.curry
|
32
|
+
end
|
33
|
+
|
20
34
|
# Creates a function that will process either the onTrue or the onFalse
|
21
35
|
# function depending upon the result of the condition predicate.
|
22
36
|
#
|
data/lib/ramda/math.rb
CHANGED
@@ -37,6 +37,14 @@ module Ramda
|
|
37
37
|
a + 1
|
38
38
|
end
|
39
39
|
|
40
|
+
# Divides the first parameter by the second and returns the remainder.
|
41
|
+
#
|
42
|
+
# Number -> Number -> Number
|
43
|
+
#
|
44
|
+
curried_method(:modulo) do |a, divider|
|
45
|
+
a % divider
|
46
|
+
end
|
47
|
+
|
40
48
|
# Multiplies two numbers. Equivalent to a * b but curried.
|
41
49
|
#
|
42
50
|
# Number -> Number -> Number
|
data/lib/ramda/object.rb
CHANGED
@@ -125,5 +125,20 @@ module Ramda
|
|
125
125
|
# {k: v} -> [v]
|
126
126
|
#
|
127
127
|
curried_method(:values, &:values)
|
128
|
+
|
129
|
+
# Takes a spec object and a test object; returns true if the test satisfies
|
130
|
+
# the spec. Each of the spec's own properties must be a predicate function.
|
131
|
+
# Each predicate is applied to the value of the corresponding property of
|
132
|
+
# the test object. where returns true if all the predicates return true,
|
133
|
+
# false otherwise.
|
134
|
+
#
|
135
|
+
# where is well suited to declaratively expressing constraints for other
|
136
|
+
# functions such as filter and find.
|
137
|
+
#
|
138
|
+
# {String: (* -> Boolean)} -> {String: *} -> Boolean
|
139
|
+
#
|
140
|
+
curried_method(:where) do |spec, test|
|
141
|
+
spec.all? { |k, v| v.call(test[k]) }
|
142
|
+
end
|
128
143
|
end
|
129
144
|
end
|
data/lib/ramda/type.rb
ADDED
data/lib/ramda/version.rb
CHANGED
data/spec/ramda/list_spec.rb
CHANGED
@@ -113,6 +113,30 @@ describe Ramda::List do
|
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
+
context '#find_index' do
|
117
|
+
it 'from docs' do
|
118
|
+
xs = [{ a: 1 }, { a: 2 }, { a: 3 }]
|
119
|
+
expect(R.find_index(R.prop_eq(:a, 2)).call(xs)).to eq(1)
|
120
|
+
expect(R.find_index(R.prop_eq(:a, 4)).call(xs)).to be_nil
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
context '#find_last' do
|
125
|
+
it 'from docs' do
|
126
|
+
xs = [{ a: 1, b: 0 }, { a: 1, b: 1 }]
|
127
|
+
expect(r.find_last(R.prop_eq(:a, 1)).call(xs)).to eq(a: 1, b: 1)
|
128
|
+
expect(r.find_last(R.prop_eq(:a, 4)).call(xs)).to be_nil
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
context '#find_last_index' do
|
133
|
+
it 'from docs' do
|
134
|
+
xs = [{ a: 1, b: 0 }, { a: 1, b: 1 }]
|
135
|
+
expect(r.find_last_index(R.prop_eq(:a, 1)).call(xs)).to eq(1)
|
136
|
+
expect(r.find_last_index(R.prop_eq(:a, 4)).call(xs)).to be_nil
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
116
140
|
context '#flatten' do
|
117
141
|
it 'from docs' do
|
118
142
|
expect(r.flatten([1, 2, [3, 4], 5, [6, [7, 8, [9, [10, 11], 12]]]]))
|
@@ -120,6 +144,16 @@ describe Ramda::List do
|
|
120
144
|
end
|
121
145
|
end
|
122
146
|
|
147
|
+
context '#for_each' do
|
148
|
+
it 'from docs' do
|
149
|
+
counter = 0
|
150
|
+
fn = ->(a) { counter += a }
|
151
|
+
|
152
|
+
expect(r.for_each(fn, [1, 2, 3])).to eq([1, 2, 3])
|
153
|
+
expect(counter).to eq(6)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
123
157
|
context '#group_by' do
|
124
158
|
it 'from docs' do
|
125
159
|
by_grade = lambda do |student|
|
@@ -172,7 +206,7 @@ describe Ramda::List do
|
|
172
206
|
it 'from docs' do
|
173
207
|
expect(r.index_of(3, [1, 2, 3, 4])).to be(2)
|
174
208
|
expect(r.index_of(1, [1, 2, 3, 4])).to be(0)
|
175
|
-
expect(r.index_of(10, [1, 2, 3, 4])).to be(
|
209
|
+
expect(r.index_of(10, [1, 2, 3, 4])).to be(nil)
|
176
210
|
end
|
177
211
|
end
|
178
212
|
|
@@ -190,7 +224,7 @@ describe Ramda::List do
|
|
190
224
|
context '#last_index_of' do
|
191
225
|
it 'from docs' do
|
192
226
|
expect(r.last_index_of(3, [-1, 3, 3, 0, 1, 2, 3, 4])).to be(6)
|
193
|
-
expect(r.last_index_of(10, [1, 2, 3, 4])).to
|
227
|
+
expect(r.last_index_of(10, [1, 2, 3, 4])).to be_nil
|
194
228
|
end
|
195
229
|
end
|
196
230
|
|
@@ -300,6 +334,17 @@ describe Ramda::List do
|
|
300
334
|
end
|
301
335
|
end
|
302
336
|
|
337
|
+
context '#repeat' do
|
338
|
+
it 'from docs' do
|
339
|
+
expect(r.repeat('hi', 5)).to eq(['hi', 'hi', 'hi', 'hi', 'hi'])
|
340
|
+
|
341
|
+
obj = {}
|
342
|
+
repeated_objs = R.repeat(obj, 5)
|
343
|
+
expect(repeated_objs).to eq([obj, obj, obj, obj, obj])
|
344
|
+
expect(repeated_objs[0]).to be(repeated_objs[1])
|
345
|
+
end
|
346
|
+
end
|
347
|
+
|
303
348
|
context '#sort' do
|
304
349
|
it 'from docs' do
|
305
350
|
diff = ->(a, b) { a - b }
|
data/spec/ramda/logic_spec.rb
CHANGED
@@ -30,6 +30,16 @@ describe Ramda::Logic do
|
|
30
30
|
expect(is_black_card.call(rank: 'Q', suit: 'diamond')).to be_falsey
|
31
31
|
end
|
32
32
|
|
33
|
+
xcontext '#complement' do
|
34
|
+
it 'from docs' do
|
35
|
+
# is_not_nil = R.complement(R.is_nil)
|
36
|
+
# expect(R.is_nil(nil)).to be_truthy
|
37
|
+
# expect(is_not_nil(nil)).to be_falsey
|
38
|
+
# expect(R.is_nil(7)).to be_falsey
|
39
|
+
# expect(is_not_nil(7)).to be_truthy
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
33
43
|
context '#if_else' do
|
34
44
|
it 'from docs' do
|
35
45
|
inc_count = R.if_else(
|
data/spec/ramda/math_spec.rb
CHANGED
@@ -35,6 +35,15 @@ describe Ramda::Math do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
context '#modulo' do
|
39
|
+
it 'from docs' do
|
40
|
+
expect(r.modulo(0, 3)).to be(0)
|
41
|
+
expect(r.modulo(42, 2)).to be(0)
|
42
|
+
expect(r.modulo(21, 2)).to be(1)
|
43
|
+
expect(r.modulo(17, 3)).to be(2)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
38
47
|
context '#multipy' do
|
39
48
|
it 'from docs' do
|
40
49
|
triple = r.multiply(3)
|
data/spec/ramda/object_spec.rb
CHANGED
@@ -114,4 +114,19 @@ describe Ramda::Object do
|
|
114
114
|
expect(r.values(a: 1, b: 2, c: 3)).to eq([1, 2, 3])
|
115
115
|
end
|
116
116
|
end
|
117
|
+
|
118
|
+
context '#where' do
|
119
|
+
it 'from docs' do
|
120
|
+
pred = R.where(a: R.equals('foo'),
|
121
|
+
# b: R.complement(R.equals('bar')),
|
122
|
+
x: R.lt(10),
|
123
|
+
y: R.gt(20))
|
124
|
+
|
125
|
+
expect(pred.call(a: 'foo', b: 'xxx', x: 11, y: 19)).to be_truthy
|
126
|
+
expect(pred.call(a: 'xxx', b: 'xxx', x: 11, y: 19)).to be_falsey
|
127
|
+
# expect(pred.call(a: 'foo', b: 'bar', x: 11, y: 19)).to be_falsey
|
128
|
+
expect(pred.call(a: 'foo', b: 'xxx', x: 10, y: 19)).to be_falsey
|
129
|
+
expect(pred.call(a: 'foo', b: 'xxx', x: 11, y: 20)).to be_falsey
|
130
|
+
end
|
131
|
+
end
|
117
132
|
end
|
data/spec/ramda_spec.rb
CHANGED
@@ -18,6 +18,7 @@ describe Ramda do
|
|
18
18
|
r(:assoc)
|
19
19
|
r(:clone)
|
20
20
|
r(:comparator)
|
21
|
+
# r(:complement)
|
21
22
|
r(:compose)
|
22
23
|
r(:concat)
|
23
24
|
r(:construct)
|
@@ -36,8 +37,12 @@ describe Ramda do
|
|
36
37
|
r(:equals)
|
37
38
|
r(:filter)
|
38
39
|
r(:find)
|
40
|
+
r(:find_index)
|
41
|
+
r(:find_last)
|
42
|
+
r(:find_last_index)
|
39
43
|
r(:flatten)
|
40
44
|
r(:flip)
|
45
|
+
r(:for_each)
|
41
46
|
r(:group_by)
|
42
47
|
r(:gt)
|
43
48
|
r(:gte)
|
@@ -49,6 +54,7 @@ describe Ramda do
|
|
49
54
|
r(:intersection)
|
50
55
|
r(:invoker)
|
51
56
|
r(:is_empty)
|
57
|
+
r(:is_nil)
|
52
58
|
r(:join)
|
53
59
|
r(:keys)
|
54
60
|
r(:last_index_of)
|
@@ -61,6 +67,7 @@ describe Ramda do
|
|
61
67
|
r(:memoize)
|
62
68
|
r(:merge)
|
63
69
|
r(:min)
|
70
|
+
r(:modulo)
|
64
71
|
r(:multiply)
|
65
72
|
r(:n_ary)
|
66
73
|
r(:not)
|
@@ -82,6 +89,7 @@ describe Ramda do
|
|
82
89
|
r(:reduce)
|
83
90
|
r(:reduce_right)
|
84
91
|
r(:reject)
|
92
|
+
r(:repeat)
|
85
93
|
r(:reverse)
|
86
94
|
r(:sort)
|
87
95
|
r(:sort_by)
|
@@ -99,6 +107,7 @@ describe Ramda do
|
|
99
107
|
r(:uniq)
|
100
108
|
r(:use_with)
|
101
109
|
r(:values)
|
110
|
+
r(:where)
|
102
111
|
r(:xprod)
|
103
112
|
r(:zip)
|
104
113
|
r(:zip_with)
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ramda-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vadim Lazebny
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: Ruby version of Ramda Js library.
|
14
14
|
email:
|
15
15
|
- vadim.lazebny@gmail.com
|
16
16
|
executables: []
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- lib/ramda/object.rb
|
38
38
|
- lib/ramda/relation.rb
|
39
39
|
- lib/ramda/string.rb
|
40
|
+
- lib/ramda/type.rb
|
40
41
|
- lib/ramda/version.rb
|
41
42
|
- spec/ramda/function_spec.rb
|
42
43
|
- spec/ramda/internal/curried_method_spec.rb
|
@@ -71,7 +72,7 @@ rubyforge_project:
|
|
71
72
|
rubygems_version: 2.6.6
|
72
73
|
signing_key:
|
73
74
|
specification_version: 4
|
74
|
-
summary:
|
75
|
+
summary: Ruby version of Ramda Js library.
|
75
76
|
test_files:
|
76
77
|
- spec/ramda_spec.rb
|
77
78
|
- spec/ramda/math_spec.rb
|