From 6593ea98e0dddcbc69845760efc6a3d1c38f9f99 Mon Sep 17 00:00:00 2001 From: Weston Ganger Date: Wed, 25 Dec 2024 23:10:34 -0800 Subject: [PATCH] Use frozen_string_literal: true --- CHANGELOG.md | 4 ++-- lib/rodf/cell.rb | 4 +++- lib/rodf/column.rb | 2 ++ lib/rodf/container.rb | 2 ++ lib/rodf/data_style.rb | 2 ++ lib/rodf/document.rb | 2 ++ lib/rodf/hyperlink.rb | 2 ++ lib/rodf/master_page.rb | 2 ++ lib/rodf/page_layout.rb | 2 ++ lib/rodf/paragraph.rb | 2 ++ lib/rodf/paragraph_container.rb | 2 ++ lib/rodf/property.rb | 12 +++++++----- lib/rodf/row.rb | 2 ++ lib/rodf/skeleton.rb | 2 ++ lib/rodf/span.rb | 2 ++ lib/rodf/spreadsheet.rb | 4 +++- lib/rodf/style.rb | 2 ++ lib/rodf/style_section.rb | 2 ++ lib/rodf/tab.rb | 2 ++ lib/rodf/table.rb | 2 ++ lib/rodf/text.rb | 4 +++- lib/rodf/version.rb | 2 ++ 22 files changed, 52 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a291f2..bd5e1d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # CHANGELOG ## Unreleased - [View Diff](https://github.com/westonganger/rodf/compare/v1.2.0..master) -- Nothing yet +- Use `frozen_string_literal: true` ## v1.2.0 - [View Diff](https://github.com/westonganger/rodf/compare/v1.1.1..v1.2.0) - Allow passing `:style` argument to `Span` @@ -67,7 +67,7 @@ ## v0.1.3 - Dependency fix (by Merul Patel) -## v0.1.2 +## v0.1.2 - Cell span ## v0.1.1 diff --git a/lib/rodf/cell.rb b/lib/rodf/cell.rb index 9c9e704..879532f 100644 --- a/lib/rodf/cell.rb +++ b/lib/rodf/cell.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Cell < Container @@ -85,7 +87,7 @@ def xml xml << paragraphs_xml end - (@multiplier - 1).times do + (@multiplier - 1).times do text = markup.tag! 'table:table-cell' end diff --git a/lib/rodf/column.rb b/lib/rodf/column.rb index 760f547..cc2ee94 100644 --- a/lib/rodf/column.rb +++ b/lib/rodf/column.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Column def initialize(opts={}) diff --git a/lib/rodf/container.rb b/lib/rodf/container.rb index d72a364..b879695 100644 --- a/lib/rodf/container.rb +++ b/lib/rodf/container.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Container def initialize(*_args, &contents) diff --git a/lib/rodf/data_style.rb b/lib/rodf/data_style.rb index ea5efec..dbfe1da 100644 --- a/lib/rodf/data_style.rb +++ b/lib/rodf/data_style.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class DataStyle < Container def initialize(name, type) diff --git a/lib/rodf/document.rb b/lib/rodf/document.rb index 65e7bb6..ed75bf0 100644 --- a/lib/rodf/document.rb +++ b/lib/rodf/document.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Document < Container def self.file(ods_file_name, &contents) diff --git a/lib/rodf/hyperlink.rb b/lib/rodf/hyperlink.rb index e6a3447..432c552 100644 --- a/lib/rodf/hyperlink.rb +++ b/lib/rodf/hyperlink.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Hyperlink < ParagraphContainer def initialize(first, second = {}) diff --git a/lib/rodf/master_page.rb b/lib/rodf/master_page.rb index da53d1d..4ed8936 100644 --- a/lib/rodf/master_page.rb +++ b/lib/rodf/master_page.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class MasterPage def initialize(name, opts = {}) diff --git a/lib/rodf/page_layout.rb b/lib/rodf/page_layout.rb index 0954eb1..5fbc9de 100644 --- a/lib/rodf/page_layout.rb +++ b/lib/rodf/page_layout.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class PageLayout < Container def initialize(name) diff --git a/lib/rodf/paragraph.rb b/lib/rodf/paragraph.rb index 9f05f55..bc82fe6 100644 --- a/lib/rodf/paragraph.rb +++ b/lib/rodf/paragraph.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Paragraph < ParagraphContainer def initialize(fst = nil, snd = {}) diff --git a/lib/rodf/paragraph_container.rb b/lib/rodf/paragraph_container.rb index 69932b8..4915af4 100644 --- a/lib/rodf/paragraph_container.rb +++ b/lib/rodf/paragraph_container.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF # Container for all kinds of paragraph content class ParagraphContainer < Container diff --git a/lib/rodf/property.rb b/lib/rodf/property.rb index dbab48e..e162412 100644 --- a/lib/rodf/property.rb +++ b/lib/rodf/property.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Property PROPERTY_NAMES = { @@ -57,19 +59,19 @@ class Property 'editable', 'protect', 'may-break-between-rows', 'rel-width', 'width', 'vertical-pos', 'vertical-rel' - ], + ], 'style' ], [ - ['height', 'y'], + ['height', 'y'], 'svg' ], [ - ['dont-balance-text-columns', 'list-level-position-and-space-mode', 'min-label-distance', 'min-label-width', 'space-before'], + ['dont-balance-text-columns', 'list-level-position-and-space-mode', 'min-label-distance', 'min-label-width', 'space-before'], 'text' ], [ - ['align', 'border-model', 'display'], + ['align', 'border-model', 'display'], 'table' ] ] @@ -124,7 +126,7 @@ def translate(specs) end def cascading_join(width_parts, style_parts, color_parts, *prefs) - [ + [ cascade(width_parts, prefs), cascade(style_parts, prefs), cascade(color_parts, prefs), diff --git a/lib/rodf/row.rb b/lib/rodf/row.rb index e589290..81981c4 100644 --- a/lib/rodf/row.rb +++ b/lib/rodf/row.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Row < Container attr_reader :number diff --git a/lib/rodf/skeleton.rb b/lib/rodf/skeleton.rb index ab3d95e..a106eba 100644 --- a/lib/rodf/skeleton.rb +++ b/lib/rodf/skeleton.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Skeleton def manifest(document_type) diff --git a/lib/rodf/span.rb b/lib/rodf/span.rb index df45a4a..ab5a6ff 100644 --- a/lib/rodf/span.rb +++ b/lib/rodf/span.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class TextNode def initialize(content) diff --git a/lib/rodf/spreadsheet.rb b/lib/rodf/spreadsheet.rb index f020985..82b3736 100644 --- a/lib/rodf/spreadsheet.rb +++ b/lib/rodf/spreadsheet.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module RODF class Spreadsheet < Document def xml builder = Builder::XmlMarkup.new builder.instruct!(:xml, version: '1.0', encoding: 'UTF-8') - + attrs = { 'xmlns:office' => "urn:oasis:names:tc:opendocument:xmlns:office:1.0", 'xmlns:table' => "urn:oasis:names:tc:opendocument:xmlns:table:1.0", diff --git a/lib/rodf/style.rb b/lib/rodf/style.rb index 67233f7..3ae7c54 100644 --- a/lib/rodf/style.rb +++ b/lib/rodf/style.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Style < Container FAMILIES = { diff --git a/lib/rodf/style_section.rb b/lib/rodf/style_section.rb index c8eec29..d5cb42d 100644 --- a/lib/rodf/style_section.rb +++ b/lib/rodf/style_section.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class StyleSection def initialize(type, second = {}) diff --git a/lib/rodf/tab.rb b/lib/rodf/tab.rb index e95f042..9e9fff7 100644 --- a/lib/rodf/tab.rb +++ b/lib/rodf/tab.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Tab def xml diff --git a/lib/rodf/table.rb b/lib/rodf/table.rb index 5144d87..f6505b7 100644 --- a/lib/rodf/table.rb +++ b/lib/rodf/table.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF class Table < Container def initialize(title = nil, opts ={}) diff --git a/lib/rodf/text.rb b/lib/rodf/text.rb index c923eb9..4664273 100644 --- a/lib/rodf/text.rb +++ b/lib/rodf/text.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module RODF class Text < Document def xml b = Builder::XmlMarkup.new b.instruct! :xml, version: '1.0', encoding: 'UTF-8' - + attrs = { 'xmlns:office' => "urn:oasis:names:tc:opendocument:xmlns:office:1.0", 'xmlns:table' => "urn:oasis:names:tc:opendocument:xmlns:table:1.0", diff --git a/lib/rodf/version.rb b/lib/rodf/version.rb index 6f23ac1..0d66da5 100644 --- a/lib/rodf/version.rb +++ b/lib/rodf/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module RODF VERSION = '1.2.0' end