Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions gems/rubyXL/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -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
46 changes: 46 additions & 0 deletions gems/rubyXL/3.4/_test/test.rb
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions gems/rubyXL/3.4/manifest.yaml
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions gems/rubyXL/3.4/rubyXL.rbs
Original file line number Diff line number Diff line change
@@ -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