ld 0.1.6 → 0.1.7
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/README.md +31 -14
- data/lib/ld/file.rb +4 -0
- data/lib/ld/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 50e5a1f20cae3fea440d8eaf969a9f074371a24e
|
|
4
|
+
data.tar.gz: c5d8f26ad095f73b35fc82fc59a4cb97e35f313d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df80d3043fef522cea7e91530ac4033ecc7dbd3c213a90eba6a7433d4c7f4fec213786defdecc55979dc4d480db68f0066ed4446129aba7baac3451bed84226b
|
|
7
|
+
data.tar.gz: 8cd0be271c635aea478bbd1c644e9e200e1fd2ac2ee6802884913d065984b2ccc1ebb6f393224c58d2b2a05c2b4b13c034fbbc8e9d764a18c198ace6a0aaf29b
|
data/README.md
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
# Ld
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Practical small tools
|
|
4
|
+
For the sake of efficiency
|
|
5
|
+
The Module is my name abbreviations LD
|
|
6
|
+
Basically has the following Class
|
|
7
|
+
|
|
5
8
|
```ruby
|
|
6
9
|
module Ld
|
|
7
10
|
class excel
|
|
@@ -33,21 +36,35 @@ Or install it yourself as:
|
|
|
33
36
|
|
|
34
37
|
## Usage
|
|
35
38
|
|
|
39
|
+
First , into the console:
|
|
40
|
+
|
|
41
|
+
$ rails c
|
|
42
|
+
|
|
43
|
+
Then, can do this:
|
|
44
|
+
|
|
36
45
|
```ruby
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
# Print model, Need to change the User model to exist, to run again
|
|
47
|
+
Ld::Table.p User.all, 'id , created_at'
|
|
48
|
+
|
|
49
|
+
# Create xls, Need to change the file path to your own, and then run
|
|
50
|
+
Ld::Excel.create '/Users/liudong/Desktop/excel_test.xls' do |excel|
|
|
51
|
+
['sheet1','sheet2','sheet3'].each do |sheet_name|
|
|
52
|
+
excel.write_sheet sheet_name do |sheet|
|
|
53
|
+
sheet.set_format({color: :red, font_size: 22, font: '宋体'})
|
|
54
|
+
sheet.set_headings (1..10).times.map{|i| "header-#{i}"}
|
|
55
|
+
sheet.set_point 'b2'
|
|
56
|
+
(1..10).to_a.each do |i|
|
|
57
|
+
sheet.add_row i.times.map{|j| "#{sheet_name}-#{i}"}
|
|
49
58
|
end
|
|
50
59
|
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Read xls
|
|
64
|
+
Ld::Excel.open('/Users/liudong/Desktop/excel_test.xls').read('sheet1?a1:e10')
|
|
65
|
+
|
|
66
|
+
# Read Dir
|
|
67
|
+
Ld::File.open_dir('dir_path').children.each{|f| puts f.path}
|
|
51
68
|
```
|
|
52
69
|
|
|
53
70
|
## Development
|
data/lib/ld/file.rb
CHANGED
data/lib/ld/version.rb
CHANGED