diff --git a/CHANGELOG.md b/CHANGELOG.md index f4fa319..24fcb00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Features: Bugs * `trim_radius` now defaults to 0 on `save_pdf`, not 38. (#270) +* `explode` on `xlsx` and `csv` now defaults to `qty`, not `Qty` (#262) Docs: * Documented the n-sided-ness of polygons and stars diff --git a/lib/squib/args/import.rb b/lib/squib/args/import.rb index 82e064d..5592eb9 100644 --- a/lib/squib/args/import.rb +++ b/lib/squib/args/import.rb @@ -9,7 +9,7 @@ module Squib def self.parameters { strip: true, - explode: 'Qty' + explode: 'qty' } end diff --git a/samples/data/explode_quantities.xlsx b/samples/data/explode_quantities.xlsx index 9e8b0ab..3be261c 100644 Binary files a/samples/data/explode_quantities.xlsx and b/samples/data/explode_quantities.xlsx differ diff --git a/samples/data/quantity_explosion.csv b/samples/data/quantity_explosion.csv index efaa11c..d5bec9b 100644 --- a/samples/data/quantity_explosion.csv +++ b/samples/data/quantity_explosion.csv @@ -1,3 +1,3 @@ -Name,Qty +Name,qty Basilisk,3 -High Templar,1 \ No newline at end of file +High Templar,1 diff --git a/spec/api/api_data_spec.rb b/spec/api/api_data_spec.rb index 074482e..0d2c7ad 100644 --- a/spec/api/api_data_spec.rb +++ b/spec/api/api_data_spec.rb @@ -39,7 +39,7 @@ describe Squib::Deck do it 'explodes quantities' do expect(Squib.csv(file: csv_file('qty.csv')).to_h).to eq({ 'Name' => %w(Ha Ha Ha Ho), - 'Qty' => [3, 3, 3, 1], + 'qty' => [3, 3, 3, 1], }) end @@ -162,9 +162,9 @@ describe Squib::Deck do end it 'explodes quantities' do - expect(Squib.xlsx(explode: 'Qty', file: xlsx_file('explode_quantities.xlsx')).to_h).to eq({ + expect(Squib.xlsx(explode: 'Quantity', file: xlsx_file('explode_quantities.xlsx')).to_h).to eq({ 'Name' => ['Zergling', 'Zergling', 'Zergling', 'High Templar'], - 'Qty' => %w(3 3 3 1), + 'Quantity' => %w(3 3 3 1), }) end diff --git a/spec/data/csv/qty.csv b/spec/data/csv/qty.csv index e99bf95..4cc0172 100644 --- a/spec/data/csv/qty.csv +++ b/spec/data/csv/qty.csv @@ -1,3 +1,3 @@ -Name,Qty +Name,qty Ha, 3 -Ho, 1 \ No newline at end of file +Ho, 1 diff --git a/spec/data/samples/data/_excel.rb.txt b/spec/data/samples/data/_excel.rb.txt index 62db50e..52354db 100644 --- a/spec/data/samples/data/_excel.rb.txt +++ b/spec/data/samples/data/_excel.rb.txt @@ -343,24 +343,6 @@ surface: finish([]) cairo: antialias=(["subpixel"]) cairo: antialias=(["subpixel"]) cairo: antialias=(["subpixel"]) -cairo: antialias=(["subpixel"]) -cairo: antialias=(["subpixel"]) -cairo: antialias=(["subpixel"]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["white"]) -cairo: paint([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["white"]) -cairo: paint([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["white"]) -cairo: paint([]) -cairo: restore([]) cairo: save([]) cairo: new_path([]) cairo: set_source_color(["white"]) @@ -423,73 +405,6 @@ cairo: stroke([]) cairo: restore([]) cairo: save([]) cairo: new_path([]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: translate([0, 0]) -cairo: rounded_rectangle([0, 0, 825, 1125, 0, 0]) -cairo: set_source_color(["#0000"]) -cairo: fill_preserve([]) -cairo: set_source_color(["black"]) -cairo: set_line_width([2.0]) -cairo: set_line_join([0]) -cairo: set_line_cap([0]) -cairo: set_dash([[]]) -cairo: stroke([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: translate([0, 0]) -cairo: rounded_rectangle([0, 0, 825, 1125, 0, 0]) -cairo: set_source_color(["#0000"]) -cairo: fill_preserve([]) -cairo: set_source_color(["black"]) -cairo: set_line_width([2.0]) -cairo: set_line_join([0]) -cairo: set_line_cap([0]) -cairo: set_dash([[]]) -cairo: stroke([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: translate([0, 0]) -cairo: rounded_rectangle([0, 0, 825, 1125, 0, 0]) -cairo: set_source_color(["#0000"]) -cairo: fill_preserve([]) -cairo: set_source_color(["black"]) -cairo: set_line_width([2.0]) -cairo: set_line_join([0]) -cairo: set_line_cap([0]) -cairo: set_dash([[]]) -cairo: stroke([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["black"]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: move_to([0, 0]) -pango: font_description=([MockDouble]) -pango: text=(["Wood"]) -pango: width=([844800]) -pango: wrap=([#]) -pango: ellipsize=([#]) -pango: alignment=([#]) -pango: justify=([false]) -cairo: move_to([0, 0]) -cairo: move_to([0, 0]) -cairo: show_pango_layout([MockDouble]) -cairo: rounded_rectangle([0, 0, 0, 0, 0, 0]) -cairo: set_source_color(["red"]) -cairo: set_line_width([2.0]) -cairo: stroke([]) -pango: ellipsized?([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) cairo: set_source_color(["black"]) cairo: translate([0, 0]) cairo: rotate([0]) @@ -517,50 +432,6 @@ cairo: translate([0, 0]) cairo: rotate([0]) cairo: move_to([0, 0]) pango: font_description=([MockDouble]) -pango: text=(["Wood"]) -pango: width=([844800]) -pango: wrap=([#]) -pango: ellipsize=([#]) -pango: alignment=([#]) -pango: justify=([false]) -cairo: move_to([0, 0]) -cairo: move_to([0, 0]) -cairo: show_pango_layout([MockDouble]) -cairo: rounded_rectangle([0, 0, 0, 0, 0, 0]) -cairo: set_source_color(["red"]) -cairo: set_line_width([2.0]) -cairo: stroke([]) -pango: ellipsized?([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["black"]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: move_to([0, 0]) -pango: font_description=([MockDouble]) -pango: text=(["Metal"]) -pango: width=([844800]) -pango: wrap=([#]) -pango: ellipsize=([#]) -pango: alignment=([#]) -pango: justify=([false]) -cairo: move_to([0, 0]) -cairo: move_to([0, 0]) -cairo: show_pango_layout([MockDouble]) -cairo: rounded_rectangle([0, 0, 0, 0, 0, 0]) -cairo: set_source_color(["red"]) -cairo: set_line_width([2.0]) -cairo: stroke([]) -pango: ellipsized?([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["black"]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: move_to([0, 0]) -pango: font_description=([MockDouble]) pango: text=(["Metal"]) pango: width=([844800]) pango: wrap=([#]) @@ -627,72 +498,6 @@ cairo: translate([0, 0]) cairo: rotate([0]) cairo: move_to([0, 0]) pango: font_description=([MockDouble]) -pango: text=(["$2k"]) -pango: width=([844800]) -pango: wrap=([#]) -pango: ellipsize=([#]) -pango: alignment=([#]) -pango: justify=([false]) -cairo: move_to([0, 0]) -cairo: move_to([0, 0]) -cairo: show_pango_layout([MockDouble]) -cairo: rounded_rectangle([0, 0, 0, 0, 0, 0]) -cairo: set_source_color(["red"]) -cairo: set_line_width([2.0]) -cairo: stroke([]) -pango: ellipsized?([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["black"]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: move_to([0, 0]) -pango: font_description=([MockDouble]) -pango: text=(["$2k"]) -pango: width=([844800]) -pango: wrap=([#]) -pango: ellipsize=([#]) -pango: alignment=([#]) -pango: justify=([false]) -cairo: move_to([0, 0]) -cairo: move_to([0, 0]) -cairo: show_pango_layout([MockDouble]) -cairo: rounded_rectangle([0, 0, 0, 0, 0, 0]) -cairo: set_source_color(["red"]) -cairo: set_line_width([2.0]) -cairo: stroke([]) -pango: ellipsized?([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["black"]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: move_to([0, 0]) -pango: font_description=([MockDouble]) -pango: text=(["$3k"]) -pango: width=([844800]) -pango: wrap=([#]) -pango: ellipsize=([#]) -pango: alignment=([#]) -pango: justify=([false]) -cairo: move_to([0, 0]) -cairo: move_to([0, 0]) -cairo: show_pango_layout([MockDouble]) -cairo: rounded_rectangle([0, 0, 0, 0, 0, 0]) -cairo: set_source_color(["red"]) -cairo: set_line_width([2.0]) -cairo: stroke([]) -pango: ellipsized?([]) -cairo: restore([]) -cairo: save([]) -cairo: new_path([]) -cairo: set_source_color(["black"]) -cairo: translate([0, 0]) -cairo: rotate([0]) -cairo: move_to([0, 0]) -pango: font_description=([MockDouble]) pango: text=(["$3k"]) pango: width=([844800]) pango: wrap=([#]) @@ -736,16 +541,7 @@ cairo: set_source([MockDouble, 100, 0]) cairo: paint([]) cairo: set_source([MockDouble, 200, 0]) cairo: paint([]) -cairo: set_source([MockDouble, 0, 101]) -cairo: paint([]) -cairo: set_source([MockDouble, 100, 101]) -cairo: paint([]) -cairo: set_source([MockDouble, 200, 101]) -cairo: paint([]) surface: write_to_png(["_output/sample_excel_resources_00.png"]) surface: finish([]) surface: finish([]) surface: finish([]) -surface: finish([]) -surface: finish([]) -surface: finish([]) diff --git a/spec/data/xlsx/explode_quantities.xlsx b/spec/data/xlsx/explode_quantities.xlsx index 9e8b0ab..f9e3aca 100644 Binary files a/spec/data/xlsx/explode_quantities.xlsx and b/spec/data/xlsx/explode_quantities.xlsx differ