Skip to content

Commit 812acf9

Browse files
Remove OpenStruct from codebase (#2144)
* Remove OpenStruct from codebase * Update docs/CHANGELOG.md --------- Co-authored-by: Joel Hawksley <[email protected]>
1 parent 070f0dd commit 812acf9

File tree

12 files changed

+27
-24
lines changed

12 files changed

+27
-24
lines changed

Gemfile.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ GEM
178178
nokogiri (1.16.7)
179179
mini_portile2 (~> 2.8.2)
180180
racc (~> 1.4)
181-
ostruct (0.6.0)
182181
parallel (1.26.3)
183182
parser (3.3.5.0)
184183
ast (~> 2.4.1)
@@ -355,7 +354,6 @@ DEPENDENCIES
355354
net-imap
356355
net-pop
357356
net-smtp
358-
ostruct
359357
pry (~> 0.13)
360358
puma (~> 6)
361359
rails (~> 7.0.0)

docs/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ nav_order: 5
1010

1111
## main
1212

13+
* Remove OpenStruct from codebase.
14+
15+
*Oleksii Vasyliev*
16+
1317
## 3.19.0
1418

1519
* Relax Active Support version constraint in gemspec.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<%= render partial: "test_partial" %>
22
<%= render "test_partial" %>
3-
<%= render OpenStruct.new(to_partial_path: "test_partial") %>
3+
<%= render PartialModel.new(to_partial_path: "test_partial") %>
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# frozen_string_literal: true
22

3-
require "ostruct"
4-
53
class ApplicationController < ActionController::Base
64
end

test/sandbox/app/controllers/integration_examples_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ def controller_to_string_render_component
4343
end
4444

4545
def products
46-
@products = [OpenStruct.new(name: "Radio clock"), OpenStruct.new(name: "Mints")]
46+
@products = [Product.new(name: "Radio clock"), Product.new(name: "Mints")]
4747
end
4848

4949
def inline_products
50-
products = [OpenStruct.new(name: "Radio clock"), OpenStruct.new(name: "Mints")]
50+
products = [Product.new(name: "Radio clock"), Product.new(name: "Mints")]
5151

5252
render(ProductComponent.with_collection(products, notice: "Today only"))
5353
end

test/sandbox/app/models/coupon.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Coupon = Struct.new(:percent_off, keyword_init: true)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PartialModel = Struct.new(:to_partial_path, keyword_init: true)

test/sandbox/app/models/photo.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Photo = Struct.new(:title, :caption, :url, keyword_init: true)

test/sandbox/app/models/product.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Product = Struct.new(:name, keyword_init: true)

test/sandbox/test/collection_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def call
1717
end
1818

1919
def setup
20-
@products = [OpenStruct.new(name: "Radio clock"), OpenStruct.new(name: "Mints")]
20+
@products = [Product.new(name: "Radio clock"), Product.new(name: "Mints")]
2121
@collection = ProductComponent.with_collection(@products, notice: "secondhand")
2222
end
2323

0 commit comments

Comments
 (0)