diff --git a/gems/rubyXL/.rubocop.yml b/gems/rubyXL/.rubocop.yml new file mode 100644 index 00000000..7d0be8ff --- /dev/null +++ b/gems/rubyXL/.rubocop.yml @@ -0,0 +1,19 @@ +# This configuration inherits from /.rubocop.yml. +# You can configure RBS style of this gem. +# This file is used on CI. It is configured to automatically +# make rubocop suggestions on pull requests for this gem. +# If you do not like the style enforcement, you should remove this file. +inherit_from: ../../.rubocop.yml + +## +# If you want to customize the style, please consult with the gem reviewers. +# You can see the list of cops at https://github.com/ksss/rubocop-on-rbs/blob/main/docs/modules/ROOT/pages/cops.adoc + +RBS/Layout: + Enabled: true + +RBS/Lint: + Enabled: true + +RBS/Style: + Enabled: true diff --git a/gems/rubyXL/3.4/_test/test.rb b/gems/rubyXL/3.4/_test/test.rb new file mode 100644 index 00000000..a9ca3d54 --- /dev/null +++ b/gems/rubyXL/3.4/_test/test.rb @@ -0,0 +1,46 @@ +require "rubyXL" +require "rubyXL/convenience_methods" + +workbook = RubyXL::Workbook.new + +worksheets = workbook.worksheets +worksheet = worksheets[0] + +new_sheet = workbook.add_worksheet("Sheet2") +new_sheet.sheet_name = "Renamed Sheet" +name = new_sheet.sheet_name + +sheet_by_index = workbook[0] +sheet_by_name = workbook["Sheet1"] + +cell = new_sheet.add_cell(0, 0, "Hello, RubyXL!") +cell2 = new_sheet.add_cell(0, 1, 42) +cell3 = new_sheet.add_cell(1, 0, 3.14) + +val = cell.value + +cell.change_fill("FF0000") +cell.change_font_bold(true) +cell.change_text_wrap(true) +cell.change_vertical_alignment("center") + +new_sheet.change_row_height(0, 20) +new_sheet.change_row_font_size(0, 12) +new_sheet.change_column_width(0, 15) + +sheet_data = new_sheet.sheet_data +rows = sheet_data.rows +row_count = sheet_data.size + +row = new_sheet[0] +if row + cells = row.cells + cell_count = row.size + + first_cell = row[0] + if first_cell + first_val = first_cell.value + end +end + +io = workbook.stream diff --git a/gems/rubyXL/3.4/manifest.yaml b/gems/rubyXL/3.4/manifest.yaml new file mode 100644 index 00000000..2d36ae95 --- /dev/null +++ b/gems/rubyXL/3.4/manifest.yaml @@ -0,0 +1,7 @@ +# manifest.yaml describes dependencies which do not appear in the gemspec. +# If this gem includes such dependencies, comment-out the following lines and +# declare the dependencies. +# If all dependencies appear in the gemspec, you should remove this file. +# +dependencies: + - name: date diff --git a/gems/rubyXL/3.4/rubyXL.rbs b/gems/rubyXL/3.4/rubyXL.rbs new file mode 100644 index 00000000..57b6fb7b --- /dev/null +++ b/gems/rubyXL/3.4/rubyXL.rbs @@ -0,0 +1,47 @@ +module RubyXL + class SheetData + def rows: () -> Array[Row?] + def []: (Integer ind) -> Row? + def size: () -> Integer + end + + class Row + def cells: () -> Array[Cell?] + def []: (Integer ind) -> Cell? + def size: () -> Integer + end + + class Cell + def value: () -> (::String | ::Integer | ::Float | ::DateTime | nil) + def change_fill: (::String rgb) -> void + def change_font_bold: (bool bold) -> void + def change_text_wrap: (bool wrap) -> void + def change_vertical_alignment: (::String alignment) -> void + end + + class Worksheet + def sheet_name: () -> ::String + def sheet_name=: (::String name) -> ::String + def sheet_data: () -> SheetData + def []: (Integer row) -> Row? + def add_cell: (Integer row_index, Integer column_index, ?untyped data, ?::String? formula, ?bool overwrite) -> Cell + def change_row_height: (?Integer row, ?::Numeric height) -> void + def change_row_font_size: (?Integer row, ?::Numeric font_size) -> void + def change_column_width: (Integer column_index, ?::Numeric width_in_chars) -> void + end + + class Workbook + def initialize: () -> void + def worksheets: () -> Array[Worksheet] + def []: (Integer index) -> Worksheet? + | (::String name) -> Worksheet? + def add_worksheet: (?::String? name) -> Worksheet + def stream: () -> ::StringIO + def write: (::String dst_file_path) -> ::String + end + + class Parser + def self.parse: (::String src_file_path) -> Workbook + def self.parse_buffer: (::IO | ::String buffer) -> Workbook + end +end