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
2 changes: 1 addition & 1 deletion docs/app/components/themes/grid/repo_tabs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Components
module Themes
module Grid
class RepoTabs < Components::Base
Repo = Struct.new(:github_url, :name, :stars, :version, keyword_init: true)
Repo = Struct.new(:github_url, :name, :stars, :version)

def view_template
Tabs(default_value: "overview", class: "w-full") do
Expand Down
2 changes: 1 addition & 1 deletion docs/app/components/themes/grid/table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Components
module Themes
module Grid
class Table < Components::Base
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url, keyword_init: true)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url)

# def view_template
# render RubyUI::Card.new(class: "p-6") do
Expand Down
2 changes: 1 addition & 1 deletion docs/app/views/docs/data_table.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Views::Docs::DataTable < Views::Base
Row = Struct.new(:id, :name, :email, :salary, :status, keyword_init: true)
Row = Struct.new(:id, :name, :email, :salary, :status)

def view_template
@rows = [
Expand Down
4 changes: 2 additions & 2 deletions docs/app/views/docs/table.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

class Views::Docs::Table < Views::Base
Invoice = Struct.new(:identifier, :status, :method, :amount, keyword_init: true)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url, keyword_init: true)
Invoice = Struct.new(:identifier, :status, :method, :amount)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url)

def view_template
component = "Table"
Expand Down
2 changes: 1 addition & 1 deletion docs/app/views/docs/tabs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Views::Docs::Tabs < Views::Base
Repo = Struct.new(:github_url, :name, :stars, :version, keyword_init: true)
Repo = Struct.new(:github_url, :name, :stars, :version)

def view_template
component = "Tabs"
Expand Down
2 changes: 1 addition & 1 deletion gem/lib/ruby_ui/data_table/data_table_docs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Views::Docs::DataTable < Views::Base
Row = Struct.new(:id, :name, :email, :salary, :status, keyword_init: true)
Row = Struct.new(:id, :name, :email, :salary, :status)

SAMPLE_ROWS = [
Row.new(id: 1, name: "Alice", email: "alice@example.com", salary: 90_000, status: "Active"),
Expand Down
4 changes: 2 additions & 2 deletions gem/lib/ruby_ui/table/table_docs.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

class Views::Docs::Table < Views::Base
Invoice = Struct.new(:identifier, :status, :method, :amount, keyword_init: true)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url, keyword_init: true)
Invoice = Struct.new(:identifier, :status, :method, :amount)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url)
Comment on lines +4 to +5

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Behavioral contract loosened: keyword_init: true is not purely redundant on Ruby 3.2+ and still enforces keyword-only initialization by rejecting positional arguments. Removing it allows silent positional call sites, increasing the risk of data mis-mapping if struct member order ever changes.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At gem/lib/ruby_ui/table/table_docs.rb, line 4:

<comment>Behavioral contract loosened: `keyword_init: true` is not purely redundant on Ruby 3.2+ and still enforces keyword-only initialization by rejecting positional arguments. Removing it allows silent positional call sites, increasing the risk of data mis-mapping if struct member order ever changes.</comment>

<file context>
@@ -1,8 +1,8 @@
 class Views::Docs::Table < Views::Base
-  Invoice = Struct.new(:identifier, :status, :method, :amount, keyword_init: true)
-  User = Struct.new(:avatar_url, :name, :username, :commits, :github_url, keyword_init: true)
+  Invoice = Struct.new(:identifier, :status, :method, :amount)
+  User = Struct.new(:avatar_url, :name, :username, :commits, :github_url)
 
</file context>
Suggested change
Invoice = Struct.new(:identifier, :status, :method, :amount)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url)
# standard:disable Style/RedundantStructKeywordInit
Invoice = Struct.new(:identifier, :status, :method, :amount, keyword_init: true)
User = Struct.new(:avatar_url, :name, :username, :commits, :github_url, keyword_init: true)
# standard:enable Style/RedundantStructKeywordInit


def view_template
component = "Table"
Expand Down
2 changes: 1 addition & 1 deletion gem/lib/ruby_ui/tabs/tabs_docs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Views::Docs::Tabs < Views::Base
Repo = Struct.new(:github_url, :name, :stars, :version, keyword_init: true)
Repo = Struct.new(:github_url, :name, :stars, :version)

def view_template
component = "Tabs"
Expand Down