ramda-ruby 0.15.0 → 0.16.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: 6f28ea9a5acc282047805422a96e187bd6b97791
4
- data.tar.gz: fde8d4617b4d1d43ba9ac481505a046abbe5c6b0
3
+ metadata.gz: a69b5e8207b7a9b33c6dbfc65e0ab0139b33efd9
4
+ data.tar.gz: 4712559e1863c803718872c0356909dfdd0ae669
5
5
  SHA512:
6
- metadata.gz: 61fb7fd43a5912c651d4f26441c2267530cf55f1b6473b91693fc8f7ba99eafc01cb739006d6d89c59cc1278e02d1464e5b95603e4c99c9e26af4bd1975af834
7
- data.tar.gz: 208dbb9efa07a6c5b6a00609c410fb81ad98245a5b7b1158b09579cb6531e13acb6d5e30752227153fc28ff4ecf53410b052446cf330367a2ec63a5126d0e5ad
6
+ metadata.gz: 698f61ac9c9590beca80454f7f0175295385d6f872e0d93fce994fe98e897e148acfadf7ba4ea904320d8ed927a6456f3148fbc59a717c5bab270c5fc541792c
7
+ data.tar.gz: 4f0d9c29a977253b65694e58632afb798777dd5585cb8511ed99032823babba9d666786fbb03285ede462c7844f2b1739e6c3da04bebf16aacbd2f71dbdbf133
@@ -1,6 +1,20 @@
1
1
  Not Released
2
2
  ---------------
3
3
 
4
+ Release 0.16.0
5
+ ---------------
6
+
7
+ * [compose_k](http://ramdajs.com/docs/#composeK)
8
+ * [drop_last](http://ramdajs.com/docs/#dropLast)
9
+ * [drop_last_while](http://ramdajs.com/docs/#dropLastWhile)
10
+ * [pipe_k](http://ramdajs.com/docs/#pipeK)
11
+ * [prop_is](http://ramdajs.com/docs/#propIs)
12
+ * [prop_satisfies](http://ramdajs.com/docs/#propSatisfies)
13
+ * [split_every](http://ramdajs.com/docs/#splitEvery)
14
+ * [take_last](http://ramdajs.com/docs/#takeLast)
15
+ * [take_last_while](http://ramdajs.com/docs/#takeLastWhile)
16
+ * [uniq_by](http://ramdajs.com/docs/#uniqBy)
17
+
4
18
  Release 0.15.0
5
19
  ---------------
6
20
 
data/README.md CHANGED
@@ -4,7 +4,7 @@ Ramda Ruby
4
4
  This is a ruby version of [Ramda Js](http://ramdajs.com) library.
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/ramda-ruby.svg)](http://badge.fury.io/rb/ramda-ruby)
7
- [![Functions](https://img.shields.io/badge/Functions-187-green.svg)](docs/FUNCTIONS.md)
7
+ [![Functions](https://img.shields.io/badge/Functions-197-green.svg)](docs/FUNCTIONS.md)
8
8
  [![Travis badge](https://travis-ci.org/lazebny/ramda-ruby.svg?branch=master)](https://travis-ci.org/lazebny/ramda-ruby)
9
9
  [![AppVeyor status](https://ci.appveyor.com/api/projects/status/ponccdax7aj4ufw2?svg=true)](https://ci.appveyor.com/project/lazebny/ramda-ruby)
10
10
  [![Coverage Status](https://coveralls.io/repos/lazebny/ramda-ruby/badge.png)](https://coveralls.io/r/lazebny/ramda-ruby)
data/ROADMAP.md CHANGED
@@ -1,19 +1,3 @@
1
- Release 0.16.0
2
- ---------------
3
- * compose_k
4
- * drop_last
5
- * drop_last_while
6
- * pipe_k
7
- * prop_is
8
- * prop_satisfies
9
- * split_every
10
- * take_last
11
- * take_last_while
12
- * uniq_by
13
-
14
- Release 0.17.0
15
- ---------------
16
-
17
1
  Release 0.18.0
18
2
  ---------------
19
3
  * eq_by
@@ -72,3 +56,8 @@ Release 0.24.0
72
56
  * merge_deep_with_key
73
57
  * o
74
58
  * starts_with
59
+
60
+ Release 0.25.0
61
+ ---------------
62
+ * apply_to
63
+ * memoize(deprecate)
@@ -23,6 +23,7 @@ Function
23
23
  * [call](http://ramdajs.com/docs/#call)
24
24
  * [comparator](http://ramdajs.com/docs/#comparator)
25
25
  * [compose](http://ramdajs.com/docs/#compose)
26
+ * [compose_k](http://ramdajs.com/docs/#composeK)
26
27
  * [construct](http://ramdajs.com/docs/#construct)
27
28
  * [construct_n](http://ramdajs.com/docs/#constructN)
28
29
  * [converge](http://ramdajs.com/docs/#converge)
@@ -43,6 +44,7 @@ Function
43
44
  * [partial](http://ramdajs.com/docs/#partial)
44
45
  * [partial_right](http://ramdajs.com/docs/#partialRight)
45
46
  * [pipe](http://ramdajs.com/docs/#pipe)
47
+ * [pipe_k](http://ramdajs.com/docs/#pipeK)
46
48
  * [tap](http://ramdajs.com/docs/#tap)
47
49
  * [unapply](http://ramdajs.com/docs/#unapply)
48
50
  * [unary](http://ramdajs.com/docs/#unary)
@@ -60,6 +62,8 @@ List
60
62
  * [concat](http://ramdajs.com/docs/#concat)
61
63
  * [contains](http://ramdajs.com/docs/#contains)
62
64
  * [drop](http://ramdajs.com/docs/#drop)
65
+ * [drop_last](http://ramdajs.com/docs/#dropLast)
66
+ * [drop_last_while](http://ramdajs.com/docs/#dropLastWhile)
63
67
  * [drop_repeats](http://ramdajs.com/docs/#dropRepeats)
64
68
  * [drop_repeats_with](http://ramdajs.com/docs/#dropRepeatsWith)
65
69
  * [drop_while](http://ramdajs.com/docs/#dropWhile)
@@ -103,13 +107,17 @@ List
103
107
  * [slice](http://ramdajs.com/docs/#slice)
104
108
  * [sort](http://ramdajs.com/docs/#sort)
105
109
  * [sort_by](http://ramdajs.com/docs/#sortBy)
110
+ * [split_every](http://ramdajs.com/docs/#splitEvery)
106
111
  * [tail](http://ramdajs.com/docs/#tail)
107
112
  * [take](http://ramdajs.com/docs/#take)- transducer
113
+ * [take_last](http://ramdajs.com/docs/#takeLast)
114
+ * [take_last_while](http://ramdajs.com/docs/#takeLastWhile)
108
115
  * [take_while](http://ramdajs.com/docs/#takeWhile)
109
116
  * [times](http://ramdajs.com/docs/#times)
110
117
  * [transduce](http://ramdajs.com/docs/#transduce)
111
118
  * [unfold](http://ramdajs.com/docs/#unfold)
112
119
  * [uniq](http://ramdajs.com/docs/#uniq)
120
+ * [uniq_by](http://ramdajs.com/docs/#uniqBy)
113
121
  * [uniq_with](http://ramdajs.com/docs/#uniqWith) - first argument is a function with 1 arity which transforms each list element and applies uniq function to results
114
122
  * [unnest](http://ramdajs.com/docs/#unnest)
115
123
  * [update](http://ramdajs.com/docs/#update)
@@ -133,6 +141,7 @@ Logic
133
141
  * [is_empty](http://ramdajs.com/docs/#isEmpty)
134
142
  * [not](http://ramdajs.com/docs/#not)
135
143
  * [or](http://ramdajs.com/docs/#or)
144
+ * [prop_satisfies](http://ramdajs.com/docs/#propSatisfies)
136
145
 
137
146
  Math
138
147
  ------------
@@ -229,4 +238,5 @@ Type
229
238
 
230
239
  * [is](http://ramdajs.com/docs/#is)
231
240
  * [is_nil](http://ramdajs.com/docs/#isNil)
241
+ * [prop_is](http://ramdajs.com/docs/#propIs)
232
242
  * [type](http://ramdajs.com/docs/#type)
@@ -30,10 +30,11 @@ chain :: Chain m => m a ~> (a -> m b) -> m b
30
30
  Comparison
31
31
  ---------------
32
32
 
33
- |Language |Library |Functor |Apply |Applicative |Chain |
34
- |-----------|----------------|--------|------|------------|------|
35
- |Haskel |out of box |<$>|fmap|<*> |pure |>>= |
36
- |JavaScript |ramda-fantasy |map |ap |of |chain |
37
- |Ruby |dry-monads |fmap | |pure |bind |
38
- |Ruby |kleisli |fmap |* | |> |
39
- |Ruby |ramda-ruby |map |ap | |chain |
33
+ |Language |Library |Functor |Apply |Applicative |Chain |
34
+ |-----------|----------------|--------|------|------------|---------|
35
+ |Haskel | |<$>|fmap|<*> |pure |>>= |
36
+ |JavaScript |ramda-fantasy |map |ap |of |chain |
37
+ |Ruby | |map | | |flat_map |
38
+ |Ruby |dry-monads |fmap | |pure |bind |
39
+ |Ruby |kleisli |fmap |* | |> |
40
+ |Ruby |ramda-ruby |map |ap | |chain |
@@ -124,6 +124,15 @@ module Ramda
124
124
  ::Ramda.pipe(*fns.reverse)
125
125
  end
126
126
 
127
+ # Chain m => ((y -> m z), (x -> m y), ..., (a -> m b)) -> (a -> m z)
128
+ # Returns the right-to-left Kleisli composition of the provided functions,
129
+ # each of which must return a value of a type supported by chain.
130
+
131
+ # R.compose_k(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).
132
+ curried_method(:compose_k) do |*fns|
133
+ ::Ramda.compose(*(fns[0..-2].map(&::Ramda.chain) + fns[-1, 1]))
134
+ end
135
+
127
136
  # Wraps a constructor function inside a curried function that can be called
128
137
  # with the same arguments and returns the same type.
129
138
  #
@@ -379,6 +388,17 @@ module Ramda
379
388
  ->(*args) { fns[1..-1].reduce(fns[0].call(*args)) { |memo, fn| fn.call(memo) } }
380
389
  end
381
390
 
391
+ # Chain m => ((a -> m b), (b -> m c), ..., (y -> m z)) -> (a -> m z)
392
+ #
393
+ # Returns the left-to-right Kleisli composition of the provided functions,
394
+ # each of which must return a value of a type supported by chain.
395
+ #
396
+ # R.pipeK(f, g, h) is equivalent to R.pipe(f, R.chain(g), R.chain(h)).
397
+ #
398
+ curried(:pipe_k) do |*fns|
399
+ ::Ramda.pipe(*(fns[0, 1] + fns[1..-1].map(&::Ramda.chain)))
400
+ end
401
+
382
402
  # Runs the given function with the supplied object, then returns the object.
383
403
  #
384
404
  # (a -> *) -> a -> a
@@ -1,5 +1,6 @@
1
1
  require_relative 'function_with_arity'
2
2
 
3
+ # rubocop:disable Performance/RedundantBlockCall
3
4
  module Ramda
4
5
  module Internal
5
6
  # Curried Method
@@ -17,7 +18,7 @@ module Ramda
17
18
  if args.index(Ramda.__)
18
19
  replace_placeholder(args, &block).curry
19
20
  else
20
- result = args.empty? ? block : yield(*args)
21
+ result = args.empty? ? block : block.call(*args)
21
22
  debug_log(name, args, result) if ::Ramda::DEBUG_MODE
22
23
  result
23
24
  end
@@ -28,11 +29,11 @@ module Ramda
28
29
  end
29
30
  # rubocop:enable Metrics/MethodLength
30
31
 
31
- def replace_placeholder(basic_args)
32
+ def replace_placeholder(basic_args, &block)
32
33
  Ramda::Internal::FunctionWithArity.call(basic_args.count(Ramda.__)) do |*new_args|
33
34
  cloned_args = basic_args.dup
34
35
  new_args.each { |arg| cloned_args[cloned_args.index(Ramda.__)] = arg }
35
- result = yield(*cloned_args)
36
+ result = block.call(*cloned_args)
36
37
  debug_log(name, cloned_args, result) if ::Ramda::DEBUG_MODE
37
38
  result
38
39
  end
@@ -42,6 +42,10 @@ module Ramda
42
42
 
43
43
  # The `Maybe` type represents the possibility of some value or nothing.
44
44
  class Maybe
45
+ def self.new(x)
46
+ x.nil? ? None.new : Some.new(x)
47
+ end
48
+
45
49
  def self.of(x)
46
50
  Some.new(x)
47
51
  end
@@ -83,7 +87,13 @@ module Ramda
83
87
  class None
84
88
  attr_reader :value
85
89
 
86
- def initialize(*); end
90
+ class << self
91
+ alias orig_new new
92
+
93
+ def new
94
+ @instance ||= orig_new
95
+ end
96
+ end
87
97
 
88
98
  def ==(other)
89
99
  instance_of?(other.class)
@@ -115,6 +115,37 @@ module Ramda
115
115
  xs[num..-1] || xs.class.new
116
116
  end)
117
117
 
118
+ # Number -> [a] -> [a]
119
+ # Number -> String -> String
120
+ #
121
+ # Returns a list containing all but the last n elements of the given list.
122
+ #
123
+ curried(:drop_last) do |x, xs|
124
+ xs[0...-x]
125
+ end
126
+
127
+ # (a -> Boolean) -> [a] -> [a]
128
+ # (a -> Boolean) -> String -> String
129
+ #
130
+ # Returns a new list excluding all the tailing elements of a given list
131
+ # which satisfy the supplied predicate function.
132
+ # It passes each value from the right to the supplied predicate function,
133
+ # skipping elements until the predicate function returns a falsy value.
134
+ # The predicate function is applied to one argument: (value).
135
+ #
136
+ curried(:drop_last_while) do |fn, xs|
137
+ lxs =
138
+ case xs
139
+ when ::String
140
+ xs.chars.to_a
141
+ else
142
+ xs
143
+ end
144
+
145
+ index = lxs.reverse.index { |x| !fn.call(x) } || 0
146
+ xs[0...-index]
147
+ end
148
+
118
149
  # Returns a new list without any consecutively repeating elements.
119
150
  # R.equals is used to determine equality.
120
151
  #
@@ -615,6 +646,28 @@ module Ramda
615
646
  xs.sort(&comparator)
616
647
  end
617
648
 
649
+ # Number -> [a] -> [[a]]
650
+ # Number -> String -> [String]
651
+ #
652
+ # Splits a collection into slices of the specified length.
653
+ #
654
+ curried(:split_every) do |num, xs|
655
+ case xs
656
+ when ::Array
657
+ xs
658
+ .each_slice(num)
659
+ .to_a
660
+ when ::String
661
+ xs
662
+ .chars
663
+ .each_slice(num)
664
+ .to_a
665
+ .map(&:join)
666
+ else
667
+ type_error(xs, :split_every)
668
+ end
669
+ end
670
+
618
671
  # Returns all but the first element of the given list or string
619
672
  # (or object with a tail method).
620
673
  #
@@ -637,6 +690,35 @@ module Ramda
637
690
  xs[0, num]
638
691
  end)
639
692
 
693
+ # Number -> [a] -> [a]
694
+ # Number -> String -> String
695
+ #
696
+ # Returns a new list containing the last n elements of the given list.
697
+ # If n > list.length, returns a list of list.length elements.
698
+ #
699
+ curried(:take_last) do |n, xs|
700
+ xs[-(n > xs.size ? xs.size : n)..-1]
701
+ end
702
+
703
+ # Number -> [a] -> [a]
704
+ # Number -> String -> String
705
+ #
706
+ # Returns a new list containing the last n elements of the given list.
707
+ # If n > list.length, returns a list of list.length elements.
708
+ #
709
+ curried(:take_last_while) do |f, xs|
710
+ lxs =
711
+ case xs
712
+ when ::String
713
+ xs.chars.to_a
714
+ else
715
+ xs
716
+ end
717
+
718
+ index = lxs.reverse.index { |x| !f.call(x) } || lxs.size
719
+ xs[-index..-1]
720
+ end
721
+
640
722
  # Returns a new list containing the first n elements of a given list,
641
723
  # passing each value to the supplied predicate function, and terminating
642
724
  # when the predicate function returns false. Excludes the element that
@@ -713,6 +795,17 @@ module Ramda
713
795
  #
714
796
  curried_method(:uniq, &:uniq)
715
797
 
798
+ # (a → b) → [a] → [a]
799
+ #
800
+ # Returns a new list containing only one copy of each element in the original list,
801
+ # based upon the value returned by applying the supplied function to each list element.
802
+ # Prefers the first item if the supplied function produces the same value on two items.
803
+ # R.equals is used for comparison.
804
+ #
805
+ curried(:uniq_by) do |f, xs|
806
+ xs.uniq(&f)
807
+ end
808
+
716
809
  # Returns a new list containing only one copy of each element in the original list,
717
810
  # based upon the value returned by applying the supplied predicate to each list
718
811
  # element.
@@ -157,5 +157,14 @@ module Ramda
157
157
  curried_method(:or) do |a, b|
158
158
  a || b
159
159
  end
160
+
161
+ # (a -> Boolean) -> String -> {String: a} -> Boolean
162
+ #
163
+ # Returns true if the specified object property satisfies the given predicate;
164
+ # false otherwise. You can test multiple properties with R.where.
165
+ #
166
+ curried(:prop_satisfies) do |fn, key, obj|
167
+ fn.call(obj[key])
168
+ end
160
169
  end
161
170
  end
@@ -20,6 +20,15 @@ module Ramda
20
20
  #
21
21
  curried_method(:is_nil, &:nil?)
22
22
 
23
+ # Type -> String -> Object -> Boolean
24
+ #
25
+ # Returns true if the specified object property is of the given type;
26
+ # false otherwise.
27
+ #
28
+ curried(:prop_is) do |type, key, obj|
29
+ obj[key].is_a?(type)
30
+ end
31
+
23
32
  # Gives a class of the (native) type of a value.
24
33
  #
25
34
  # (* -> {*}) -> String
@@ -1,3 +1,3 @@
1
1
  module Ramda
2
- VERSION = '0.15.0'.freeze
2
+ VERSION = '0.16.0'.freeze
3
3
  end
@@ -223,6 +223,23 @@ describe Ramda::Function do
223
223
  end
224
224
  end
225
225
 
226
+ context '#compose_k' do
227
+ it 'from docs' do
228
+ # get :: String -> Object -> Maybe *
229
+ get = R.curry(->(prop_name, obj) { Maybe.new(obj[prop_name]) })
230
+
231
+ # get_status_code :: Maybe String -> Maybe String
232
+ get_status_code = R.compose_k(
233
+ R.compose(Maybe.method(:new), R.to_upper),
234
+ get[:state],
235
+ get[:address],
236
+ get[:user]
237
+ )
238
+ expect(get_status_code.call(user: { address: { state: 'ny' } })).to eq(Maybe::Some.new('NY'))
239
+ expect(get_status_code.call({})).to eql(Maybe::None.new)
240
+ end
241
+ end
242
+
226
243
  context '#construct' do
227
244
  it 'from docs' do
228
245
  array_builder = r.construct(Array)
@@ -540,6 +557,37 @@ describe Ramda::Function do
540
557
  end
541
558
  end
542
559
 
560
+ context '#pipe_k' do
561
+ it 'from docs' do
562
+ # parse_json :: String -> Maybe *
563
+ parse_json = lambda do |json|
564
+ Maybe.new(
565
+ begin
566
+ JSON.parse(json)
567
+ rescue
568
+ nil
569
+ end
570
+ )
571
+ end
572
+
573
+ # get :: String -> Object -> Maybe *
574
+ get = R.curry(->(prop_name, obj) { Maybe.new(obj[prop_name]) })
575
+
576
+ # get_status_code :: Maybe String -> Maybe String
577
+ get_status_code = R.pipe_k(
578
+ parse_json,
579
+ get['user'],
580
+ get['address'],
581
+ get['state'],
582
+ R.compose(Maybe.method(:of), R.to_upper)
583
+ )
584
+
585
+ actual = get_status_code.call('{"user":{"address":{"state":"ny"}}}')
586
+ expect(actual).to eq(Maybe::Some.new('NY'))
587
+ expect(get_status_code.call('[Invalid JSON]')).to eq(Maybe::None.new)
588
+ end
589
+ end
590
+
543
591
  context '#tap' do
544
592
  it 'from docs' do
545
593
  say_x = instance_double(Proc)
@@ -140,6 +140,32 @@ describe Ramda::List do
140
140
  end
141
141
  end
142
142
 
143
+ context '#drop_last' do
144
+ it 'from docs' do
145
+ expect(R.drop_last(1, ['foo', 'bar', 'baz'])).to eq(['foo', 'bar'])
146
+ expect(R.drop_last(2, ['foo', 'bar', 'baz'])).to eq(['foo'])
147
+ expect(R.drop_last(3, ['foo', 'bar', 'baz'])).to eq([])
148
+ expect(R.drop_last(4, ['foo', 'bar', 'baz'])).to eq([])
149
+ expect(R.drop_last(3, 'ramda')).to eq('ra')
150
+ end
151
+ end
152
+
153
+ context '#drop_last_while' do
154
+ it 'from docs' do
155
+ lte_three = ->(x) { x <= 3 }
156
+
157
+ expect(R.drop_last_while(lte_three, [1, 2, 3, 4, 3, 2, 1])).to eq([1, 2, 3, 4])
158
+
159
+ not_d = ->(x) { x != 'd' }
160
+ expect(R.drop_last_while(not_d, 'Ramda')).to eq('Ramd')
161
+ end
162
+
163
+ it 'returns empty list' do
164
+ always_fn = ->(*) { true }
165
+ expect(R.drop_last_while(always_fn, [1, 2, 3])).to eq([])
166
+ end
167
+ end
168
+
143
169
  context '#drop_repeats' do
144
170
  let(:x1s) { [1, 2, 3, 4, 5, 3, 2] }
145
171
  let(:x2s) { [1, 2, 2, 2, 3, 4, 4, 5, 5, 3, 2, 2] }
@@ -666,6 +692,13 @@ describe Ramda::List do
666
692
  end
667
693
  end
668
694
 
695
+ context '#split_every' do
696
+ it 'from docs' do
697
+ expect(R.split_every(3, [1, 2, 3, 4, 5, 6, 7])).to eq([[1, 2, 3], [4, 5, 6], [7]])
698
+ expect(R.split_every(3, 'foobarbaz')).to eq(['foo', 'bar', 'baz'])
699
+ end
700
+ end
701
+
669
702
  context '#tail' do
670
703
  it 'from docs' do
671
704
  expect(r.tail([1, 2, 3])).to eq([2, 3])
@@ -717,6 +750,27 @@ describe Ramda::List do
717
750
  end
718
751
  end
719
752
 
753
+ context '#take_last' do
754
+ it 'from docs' do
755
+ expect(R.take_last(1, ['foo', 'bar', 'baz'])).to eq(['baz'])
756
+ expect(R.take_last(2, ['foo', 'bar', 'baz'])).to eq(['bar', 'baz'])
757
+ expect(R.take_last(3, ['foo', 'bar', 'baz'])).to eq(['foo', 'bar', 'baz'])
758
+ expect(R.take_last(4, ['foo', 'bar', 'baz'])).to eq(['foo', 'bar', 'baz'])
759
+ expect(R.take_last(3, 'ramda')).to eq('mda')
760
+ end
761
+ end
762
+
763
+ context '#take_last_while' do
764
+ it 'from docs' do
765
+ is_not_one = ->(x) { x != 1 }
766
+
767
+ expect(R.take_last_while(is_not_one, [1, 2, 3, 4])).to eq([2, 3, 4])
768
+
769
+ is_not_r = ->(x) { x != 'R' }
770
+ expect(R.take_last_while(is_not_r, 'Ramda')).to eq('amda')
771
+ end
772
+ end
773
+
720
774
  context '#take_while' do
721
775
  it 'from docs' do
722
776
  is_not_four = ->(x) { x != 4 }
@@ -799,6 +853,12 @@ describe Ramda::List do
799
853
  end
800
854
  end
801
855
 
856
+ context '#uniq_by' do
857
+ it 'from docs' do
858
+ expect(R.uniq_by(:abs.to_proc, [-1, -5, 2, 10, 1, 2])).to eq([-1, -5, 2, 10])
859
+ end
860
+ end
861
+
802
862
  context '#uniq_with' do
803
863
  it 'from docs' do
804
864
  str_eq = R.invoker(0, 'to_s')
@@ -159,4 +159,11 @@ describe Ramda::Logic do
159
159
  expect(r.or(false, false)).to be_falsey
160
160
  end
161
161
  end
162
+
163
+ context '#prop_satisfies' do
164
+ it 'from docs' do
165
+ expect(R.prop_satisfies(0.method(:<), :x, x: 1, y: 2)).to be_truthy
166
+ expect(R.prop_satisfies(0.method(:<), :x, x: -1, y: 2)).to be_falsey
167
+ end
168
+ end
162
169
  end
@@ -24,6 +24,14 @@ describe Ramda::Type do
24
24
  end
25
25
  end
26
26
 
27
+ context '#prop_is' do
28
+ it 'from docs' do
29
+ expect(R.prop_is(Integer, :x, x: 1, y: 2)).to be_truthy
30
+ expect(R.prop_is(Integer, :x, x: 'foo')).to be_falsey
31
+ expect(R.prop_is(Integer, :x, {})).to be_falsey
32
+ end
33
+ end
34
+
27
35
  context '#type' do
28
36
  it 'from docs' do
29
37
  expect(r.type({})).to be(Hash)
@@ -40,6 +40,7 @@ describe Ramda do
40
40
  r(:comparator)
41
41
  r(:complement)
42
42
  r(:compose)
43
+ r(:compose_k)
43
44
  r(:concat)
44
45
  r(:cond)
45
46
  r(:construct)
@@ -57,6 +58,8 @@ describe Ramda do
57
58
  r(:dissoc_path)
58
59
  r(:divide)
59
60
  r(:drop)
61
+ r(:drop_last)
62
+ r(:drop_last_while)
60
63
  r(:drop_repeats)
61
64
  r(:drop_repeats_with)
62
65
  r(:drop_while)
@@ -146,12 +149,14 @@ describe Ramda do
146
149
  r(:pick_all)
147
150
  r(:pick_by)
148
151
  r(:pipe)
152
+ r(:pipe_k)
149
153
  r(:pluck)
150
154
  r(:prepend)
151
155
  r(:product)
152
156
  r(:project)
153
157
  r(:prop)
154
158
  r(:prop_eq)
159
+ r(:prop_is)
155
160
  r(:prop_or)
156
161
  r(:props)
157
162
  r(:range)
@@ -169,10 +174,13 @@ describe Ramda do
169
174
  r(:sort)
170
175
  r(:sort_by)
171
176
  r(:split)
177
+ r(:split_every)
172
178
  r(:subtract)
173
179
  r(:sum)
174
180
  r(:tail)
175
181
  r(:take)
182
+ r(:take_last)
183
+ r(:take_last_while)
176
184
  r(:take_while)
177
185
  r(:tap)
178
186
  r(:test)
@@ -190,6 +198,7 @@ describe Ramda do
190
198
  r(:union)
191
199
  r(:union_with)
192
200
  r(:uniq)
201
+ r(:uniq_by)
193
202
  r(:uniq_with)
194
203
  r(:unnest)
195
204
  r(:update)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ramda-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
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-08-13 00:00:00.000000000 Z
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby version of Ramda Js library.
14
14
  email: