core_extend 0.1.4 → 0.1.5
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +48 -5
- data/lib/core_extend/random.rb +7 -0
- data/lib/core_extend/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e9d56ced4bc7c5adbdb561052adb0ce9de631a3
|
4
|
+
data.tar.gz: f19b929050ede5c05232e0ab36ba608cd71f3122
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1db03188c6476bd71bbdc82f6b84aa47d88486fe7c94e15042b6d9325c3c299388926661d8a18592ef5bc92c4a60524185e57af6b047ddea7b6f75bc359c4766
|
7
|
+
data.tar.gz: b72c61facca1c5c34d40f0326f96f8dd7e0d05c1264131c652009c5012f87b3e20113bdece3a0b6cb926bc6a2b1c08cfcee2b48d5e89e19ab3ad8f23d5a7ef04
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# CoreExtend
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
gem主要包括数组的遍历、浮点数的小数点精度的确定、金钱显示、随机字符串等常用操作
|
6
4
|
|
7
5
|
## Installation
|
6
|
+
Add this line to `config/application.rb`
|
7
|
+
|
8
|
+
require 'core_extend'
|
8
9
|
|
9
10
|
Add this line to your application's Gemfile:
|
10
11
|
|
@@ -20,9 +21,51 @@ Or install it yourself as:
|
|
20
21
|
|
21
22
|
$ gem install core_extend
|
22
23
|
|
23
|
-
##
|
24
|
+
## Array
|
25
|
+
|
26
|
+
### every
|
27
|
+
```ruby
|
28
|
+
it 'every' do
|
29
|
+
(1..20).to_a.every(3) { |a, b, c|
|
30
|
+
p "#{a},#{b},#{c}"
|
31
|
+
}
|
32
|
+
end
|
33
|
+
#=>"1,2,3"
|
34
|
+
#=>"4,5,6"
|
35
|
+
#=>"7,8,9"
|
36
|
+
#=>"10,11,12"
|
37
|
+
#=>"13,14,15"
|
38
|
+
#=>"16,17,18"
|
39
|
+
#=>"19,20,"
|
40
|
+
```
|
41
|
+
|
42
|
+
## Float
|
43
|
+
|
44
|
+
###decimal_point
|
45
|
+
```ruby
|
46
|
+
3.2268.decimal_point(2)
|
47
|
+
#=>3.23
|
48
|
+
```
|
49
|
+
###to_money
|
50
|
+
```ruby
|
51
|
+
123456789.456.to_money #=>"123,456,789.46"
|
52
|
+
32005487.45.to_money('text') #=>"3200.55万"
|
53
|
+
2332005487.45.to_money('text',4) #=>"23.3201亿"
|
54
|
+
2332005487.45.to_money('text',0) #=>"23亿"
|
55
|
+
2332005487.45.to_money('num',2) #=>"2,332,005,487.45"
|
56
|
+
2332005487.45.to_money('num',0) #=>"2,332,005,487"
|
57
|
+
1.to_money #=>"1.0"
|
58
|
+
```
|
59
|
+
|
60
|
+
## Random
|
61
|
+
|
62
|
+
###rand_str
|
63
|
+
```ruby
|
64
|
+
str = Random.rand_str(32)
|
65
|
+
p str
|
66
|
+
#=>"tdb1hruwxd8p0z5qtdl7pvhva5uxbru9"
|
67
|
+
```
|
24
68
|
|
25
|
-
TODO: Write usage instructions here
|
26
69
|
|
27
70
|
## Development
|
28
71
|
|
data/lib/core_extend/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/core_extend/float.rb
|
62
62
|
- lib/core_extend/float_module.rb
|
63
63
|
- lib/core_extend/integer.rb
|
64
|
+
- lib/core_extend/random.rb
|
64
65
|
- lib/core_extend/version.rb
|
65
66
|
homepage: https://github.com/mumaoxi/core_extend
|
66
67
|
licenses:
|