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 +4 -4
- data/README.rdoc +9 -0
- data/lib/rafini/array.rb +9 -0
- data/lib/rafini/empty.rb +1 -0
- data/lib/rafini/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d0b7bcd26289ae8b80bd97a8473e00c791f0752
|
4
|
+
data.tar.gz: 58689d8e95c43ba906bec2dd553024fe6c3a07b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/rafini/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2014-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Just a collection of useful refinements.
|