Class: Excelsed
- Inherits:
-
Object
- Object
- Excelsed
- Defined in:
- lib/excelsed.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#scan_mappings ⇒ Object
readonly
Returns the value of attribute scan_mappings.
-
#tmp_dir ⇒ Object
readonly
Returns the value of attribute tmp_dir.
Instance Method Summary collapse
-
#initialize(file_path, scan_mappings, output_dir, file_name: 'output') ⇒ Excelsed
constructor
A new instance of Excelsed.
- #perform ⇒ Object
Constructor Details
#initialize(file_path, scan_mappings, output_dir, file_name: 'output') ⇒ Excelsed
Returns a new instance of Excelsed.
4 5 6 7 8 9 10 11 12 |
# File 'lib/excelsed.rb', line 4 def initialize file_path, scan_mappings, output_dir, file_name: 'output' @file_path = file_path @scan_mappings = scan_mappings @output_dir = output_dir @tmp_dir = "#{output_dir}/tmp" @file_name = file_name FileUtils.mkdir_p(tmp_dir) end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
2 3 4 |
# File 'lib/excelsed.rb', line 2 def file_name @file_name end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
2 3 4 |
# File 'lib/excelsed.rb', line 2 def file_path @file_path end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
2 3 4 |
# File 'lib/excelsed.rb', line 2 def output_dir @output_dir end |
#scan_mappings ⇒ Object (readonly)
Returns the value of attribute scan_mappings.
2 3 4 |
# File 'lib/excelsed.rb', line 2 def scan_mappings @scan_mappings end |
#tmp_dir ⇒ Object (readonly)
Returns the value of attribute tmp_dir.
2 3 4 |
# File 'lib/excelsed.rb', line 2 def tmp_dir @tmp_dir end |
Instance Method Details
#perform ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/excelsed.rb', line 14 def perform perform_unzip sed_mappings export_result {file_path: "#{output_dir}/#{file_name}.xlsx"} ensure FileUtils.rm_rf(tmp_dir) end |