Class: Excel2CSV::Info
- Inherits:
-
Object
- Object
- Excel2CSV::Info
- Defined in:
- lib/excel2csv/info.rb
Instance Attribute Summary collapse
-
#previews ⇒ Object
Returns the value of attribute previews.
-
#sheets ⇒ Object
Returns the value of attribute sheets.
-
#working_folder ⇒ Object
Returns the value of attribute working_folder.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#previews ⇒ Object
Returns the value of attribute previews.
7 8 9 |
# File 'lib/excel2csv/info.rb', line 7 def previews @previews end |
#sheets ⇒ Object
Returns the value of attribute sheets.
6 7 8 |
# File 'lib/excel2csv/info.rb', line 6 def sheets @sheets end |
#working_folder ⇒ Object
Returns the value of attribute working_folder.
8 9 10 |
# File 'lib/excel2csv/info.rb', line 8 def working_folder @working_folder end |
Class Method Details
.read(working_folder) ⇒ Object
10 11 12 13 14 |
# File 'lib/excel2csv/info.rb', line 10 def self.read working_folder info = Info.new working_folder info.read info end |
Instance Method Details
#clean ⇒ Object
35 36 37 |
# File 'lib/excel2csv/info.rb', line 35 def clean FileUtils.remove_entry_secure(@working_folder, true) if @working_folder end |
#read ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/excel2csv/info.rb', line 16 def read info = JSON.parse(File.read("#{@working_folder}/info.json")) info['sheets'].each do |sheet_info| @sheets << { path: "#{@working_folder}/#{sheet_info['fullOutput']}", total_rows: sheet_info['rowCount'], rows: sheet_info['rowCount'], title: sheet_info['title'] } @previews << { path: "#{@working_folder}/#{sheet_info['previewOutput']}", total_rows: sheet_info['rowCount'], rows: info['perSheetRowLimitForPreviews'], title: sheet_info['title'] } if sheet_info['previewOutput'] end end |