core_extend 0.1.9 → 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: ca028b31f1c5ab4a581e9db31f04f08619846f3b
4
- data.tar.gz: 21f3bcacfc7cbccf61d7eb8be12d936836f6f66e
3
+ metadata.gz: 0ab8030459f0a15b08a95325e0bf57901cdbe4ad
4
+ data.tar.gz: ca29ed6691cfe3b1afa30da751ad2b781121e958
5
5
  SHA512:
6
- metadata.gz: 6903fcb0fd0b4209bb836bcc0edd76538b3eb0777d939ed69998ae193ef1e3c885f26853b7b42100f1895c2846769750c22b1943a1912e68e65f9824f8aec061
7
- data.tar.gz: 82d661e67200d650c9a893ea867806e5969b4ce2092e81ba21e1f2420a4f7d68601c205c97a98342397fe7da64f116a361418e6ab3b3909297668c97cbbb915e
6
+ metadata.gz: 4dc50f0dfcd3b6c6bdc893f883760d45280a37bbbed416908481ac5a875609e6a8c06f5ba06b069793a5b67df3e7917c0a0e7e37d0dd1d432b80221cb2591aca
7
+ data.tar.gz: 9e037beae04d23ecef7b0b31dd75d6aa5b2349ccf0b435c04bc8431de84d0e3a5cc7cf3556510c4194b6577dcfcc69d9717d2c80deaf6b4cebf99df10eb0dec7
data/README.md CHANGED
@@ -23,6 +23,14 @@ Or install it yourself as:
23
23
 
24
24
  $ gem install core_extend
25
25
 
26
+ ## String
27
+
28
+ ### urlencode
29
+ ```ruby
30
+ 'name=小明&sex=男'.urlencode
31
+ #=> "name%3D%E5%B0%8F%E6%98%8E%26sex%3D%E7%94%B7"
32
+ ```
33
+
26
34
  ## Array
27
35
 
28
36
  ### every
@@ -56,6 +64,10 @@ Or install it yourself as:
56
64
  2332005487.45.to_money('num',0) #=>"2,332,005,487"
57
65
  1.to_money #=>"1.0"
58
66
  ```
67
+ ### to_size
68
+ ```ruby
69
+ 45200455.to_size #=>"45.2 MB"
70
+ ```
59
71
 
60
72
  ## Random
61
73
 
@@ -1,3 +1,8 @@
1
1
  class String
2
2
 
3
+ def urlencode
4
+ self.dup.force_encoding('ASCII-8BIT').gsub(/[^a-zA-Z0-9_\-.\*]/) do
5
+ sprintf('%%%02X', $&.unpack('C')[0])
6
+ end
7
+ end
3
8
  end
@@ -1,3 +1,3 @@
1
1
  module CoreExtend
2
- VERSION = '0.1.9'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: core_extend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - saxer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2016-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -86,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  version: '0'
87
87
  requirements: []
88
88
  rubyforge_project:
89
- rubygems_version: 2.4.6
89
+ rubygems_version: 2.4.3
90
90
  signing_key:
91
91
  specification_version: 4
92
92
  summary: Ruby core extensions