modle_to_excel 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22022d7224158c31ffac736b4d39c7c9f9048a28
4
- data.tar.gz: 38aff3e232ae46d26736e5dbeb5c4f45bfc19908
3
+ metadata.gz: 2c48124492fcf95b198a3e7515fd6e78d90a993d
4
+ data.tar.gz: 5ac60806167ba3fcf373ece04162f1de238d0545
5
5
  SHA512:
6
- metadata.gz: af0cd3f6bac56c67bae0085d7afa61d4f8b1ce4d32b653acca3066567d495c02b06b2c55d1984fb1394c903eaab3b0df76fdb711cfdd39bbe6423ee43ddbcfc4
7
- data.tar.gz: 0e554ccafbb78d51eeffa1033dff59631352f506f0f3de48f9fb3b92126d4a0bc8b9251d99e49d68dc76fc1fe4e9021276b5a5069130845aa70ac308efe1f899
6
+ metadata.gz: ab8049e95c484d59ff9a9c213e505da3b6788f29a0c8711680f44f2dae614b579bdb38727e1d86e1a6054436d130f17b534844b08d1fdf6364ccd9d00f1b36a2
7
+ data.tar.gz: ebaf36c582f858fe6223d760d159aa1352d180fb422f0229956f9d27ff28da05c308d91de5e12fe211cd4577e3ddcaafe48d650cf7781762a95eadffe65dcbb2
@@ -1,3 +1,3 @@
1
1
  module ModleToExcel
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -6,33 +6,32 @@ module ModleToExcel
6
6
  Spreadsheet.client_encoding = "UTF-8"
7
7
  book = Spreadsheet::Workbook.new
8
8
  first_row = ["编号","字段","类型","注释"]
9
-
10
- ActiveRecord::Base.connection.tables.each do |table|
11
- next if table.match(/\Aschema_migrations\z/)
12
-
13
- sheet = book.create_worksheet :name => table
14
- #第一横行
15
- sheet.row(0).concat first_row
16
- num = 1
17
- class_name = table.singularize.classify
18
- class_name.constantize.columns.each do |column|
19
- puts column
20
- puts column.type
21
- sheet[num, 0] = num
22
- sheet[num, 1] = column.name
23
- sheet[num, 2] = column.type.to_s
24
- sheet[num, 3] = ""
25
- num += 1
26
-
9
+
10
+ ActiveRecord::Base.connection.tables.each do |table|
11
+ next if table.match(/\Aschema_migrations\z/)
12
+ begin
13
+ sheet = book.create_worksheet :name => table
14
+ #第一横行
15
+ sheet.row(0).concat first_row
16
+ num = 1
17
+ class_name = table.singularize.classify
18
+ class_name.constantize.columns.each do |column|
19
+ puts column
20
+ puts column.type
21
+ sheet[num, 0] = num
22
+ sheet[num, 1] = column.name
23
+ sheet[num, 2] = column.type.to_s
24
+ sheet[num, 3] = ""
25
+ num += 1
26
+
27
+ end
28
+ rescue Exception => e
29
+ puts "table"
30
+ puts table
31
+ table_names << table
32
+ next
33
+ end
27
34
  end
28
-
29
- # rescue Exception => e
30
- # puts "table"
31
- # puts table
32
- # table_names << table
33
- # next
34
- # end
35
- end
36
35
  book.write "#{Rails.root}/public/#{file_name}.xls"
37
36
  end
38
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modle_to_excel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - lxyu1993