rafini 0.1.0 → 0.2.0

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
  SHA1:
3
- metadata.gz: df7c69a48af394977dc232bb7ec68d7d0bd38163
4
- data.tar.gz: 26888c60372728d2a032aeca290b3d3a126b1b5d
3
+ metadata.gz: 1d0b7bcd26289ae8b80bd97a8473e00c791f0752
4
+ data.tar.gz: 58689d8e95c43ba906bec2dd553024fe6c3a07b4
5
5
  SHA512:
6
- metadata.gz: f9d4dd4c640492cb7a78510c71c18173fb1b5e64230a6a59df6d8d07e5cf60f9b2f4b2689c285001b6a4ae947e0b51230d5ec752bafcdc2872928322bb964d52
7
- data.tar.gz: 798ca7a624a178726446cf4adc8012fb40d5c9afd01da76e0f97e9e013128bc033163156355444e16e5d0c3420c0e8c70bdc772ea4b8d630bae13e4c45fbe8cc
6
+ metadata.gz: 526ac61f8dbc7497232d5e235d85129230628ed29f2075313180007afe7003a05c64a0a4afaf38393059445830245f5e999beb7dba2b53219b637f8a0c974200
7
+ data.tar.gz: a4cc545cec4a3cd3a4742cdc7aabf6c4c072becc0e9546229ea277778b77aecf33ebc8e4f43f287ef5eafa52b7815f9ab70171b63bed40cc6700969d4c28f85b
data/README.rdoc CHANGED
@@ -43,6 +43,15 @@ Just a collection of useful refinements.
43
43
  struct = {a:'A',b:'C',c:'C'}.to_struct
44
44
  struct.a #=> 'A'
45
45
 
46
+ # modify
47
+ {a:'A',b:'B'}.modify({b:'X',c:'C'},{c:'Y',d:'D'}) #=> {a:'A',b:'X',c:'Y',d:'D'}
48
+
49
+ # supplement
50
+ {a:'A',b:'B'}.supplement({b:'X',c:'C'},{c:'Y',d:'D'}) #=> {a:'A',b:'B',c:'C',d:'D'}
51
+
52
+ # ammend
53
+ {a:'A',b:'B'}.supplement({b:'X',c:'C'},{c:'Y',d:'D'}) #=> {a:'A',b:'X'}
54
+
46
55
  === using Rafini::Integer
47
56
 
48
57
  # odometer
data/lib/rafini/array.rb CHANGED
@@ -37,6 +37,15 @@ module Rafini
37
37
  0.upto(length-1){|i| yield self[i], (b)? b[i] : i}
38
38
  end
39
39
 
40
+ # array.which{|a|...}
41
+ #
42
+ # Returns first object for which block is true.
43
+ # ['dog','cat','bunny'].which{|a|a=~/c/} #=> "cat"
44
+ def which
45
+ self.each{|obj| return obj if yield(obj)}
46
+ return nil
47
+ end
48
+
40
49
  end
41
50
  end
42
51
  end
data/lib/rafini/empty.rb CHANGED
@@ -5,5 +5,6 @@ module Rafini
5
5
  module Empty
6
6
  ARRAY = [].freeze
7
7
  HASH = {}.freeze
8
+ STRING = ''.freeze # TODO: Empty::STRING
8
9
  end
9
10
  end
@@ -1,3 +1,3 @@
1
1
  module Rafini
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rafini
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  Just a collection of useful refinements.