rafini 1.1.0 → 1.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 +6 -0
- data/lib/rafini/string.rb +10 -1
- 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: dec030a515decf9c06b93546a0f212df061799c2
|
4
|
+
data.tar.gz: 92df305b30cbbc72bed2b967076073a7b8a3e770
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b1911db07e48d9614ca1c9d3b5955937163e2b8b09858ffe831af8f8f86eab4edc2a6c3f236cb720e6bb70a40262e17e29d0d0ce2cfeaa2c05bd0c21ed2df20
|
7
|
+
data.tar.gz: bdb731aecd1be0c482e3eb9ea7f86ec5855a375507d54bb98836a383b4306a35ee7aa7fd3fc5fb26931fdfb6fbc6fee1236ec129885527c87cbfc1fcd0da5679
|
data/README.rdoc
CHANGED
@@ -58,6 +58,9 @@ Just a collection of useful refinements.
|
|
58
58
|
# amend
|
59
59
|
{a:'A',b:'B'}.amend({b:'X',c:'C'},{c:'Y',d:'D'}) #=> {a:'A',b:'X'}
|
60
60
|
|
61
|
+
# maps
|
62
|
+
{a:'A',b:'B',c:'C',c:'D'}.maps(:c,:a,:b) #=> ['C','A','B']
|
63
|
+
|
61
64
|
=== using Rafini::Integer
|
62
65
|
|
63
66
|
# odometer
|
@@ -77,6 +80,9 @@ Just a collection of useful refinements.
|
|
77
80
|
# camelize
|
78
81
|
'a_camel_kick'.camelize #=> "ACamelKick"
|
79
82
|
|
83
|
+
# semantic
|
84
|
+
'1.2.3'.semantic(0..1) #=> '1.2'
|
85
|
+
|
80
86
|
=== Rafini::Empty
|
81
87
|
|
82
88
|
STRING, ARRAY, HASH = ''.frozen, [].frozen, {}.frozen
|
data/lib/rafini/string.rb
CHANGED
@@ -5,7 +5,16 @@ module Rafini
|
|
5
5
|
# 1) A camel kick, as in "I gotz camelized".
|
6
6
|
# 2) "a_camel_kick" => "ACamelKick"
|
7
7
|
def camelize(sep=/_/)
|
8
|
-
self.split(sep).map{
|
8
|
+
self.split(sep).map{|word|word.capitalize }.join('')
|
9
|
+
end
|
10
|
+
|
11
|
+
# semantic:
|
12
|
+
# 'a.b.c'.semantic(1) #=> 'b'
|
13
|
+
# 'a.b.c'.semantic(0..1) #=> 'a.b'
|
14
|
+
# 'a.b.c'.semantic(0..2, '/') #=> 'b/c'
|
15
|
+
# 'a/b/c'.semantic(0..2, '.', /\//) #=> 'a.b.c'
|
16
|
+
def semantic(v,s='.',sx=/\./)
|
17
|
+
[*self.split(sx)[v]].join(s)
|
9
18
|
end
|
10
19
|
end
|
11
20
|
end
|
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: 1.
|
4
|
+
version: 1.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-12-
|
11
|
+
date: 2014-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
Just a collection of useful refinements.
|