Skip to content

Commit c16d709

Browse files
committed
Fix Style/MapIntoArray rubocop errors
1 parent 1c6a450 commit c16d709

File tree

4 files changed

+13
-23
lines changed

4 files changed

+13
-23
lines changed

app/presenters/v3/relationship_presenter.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,9 @@ def to_hash
1616
private
1717

1818
def build_relations
19-
data = []
20-
21-
@relationships.each do |relationship|
22-
data << { name: relationship.name, guid: relationship.guid, link: "/v2/#{@relation_url}/#{relationship.guid}" }
19+
@relationships.map do |relationship|
20+
{ name: relationship.name, guid: relationship.guid, link: "/v2/#{@relation_url}/#{relationship.guid}" }
2321
end
24-
25-
data
2622
end
2723
end
2824
end

app/presenters/v3/to_many_relationship_presenter.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ def to_hash
2525
private
2626

2727
def build_relations
28-
data = []
29-
30-
@relationships.each do |relationship|
31-
data << { guid: relationship.guid }
28+
@relationships.map do |relationship|
29+
{ guid: relationship.guid }
3230
end
33-
34-
data
3531
end
3632

3733
def build_links

docs/v3/helpers/docs_helpers.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ def current_version
1313
def extract_table_of_contents(html)
1414
page = Nokogiri::HTML(html)
1515

16-
headings = []
17-
page.css('h1,h2,h3').each do |heading|
18-
headings.push({
19-
id: heading.attribute('id').to_s,
20-
text: heading.content,
21-
level: heading.name[1].to_i,
22-
children: []
23-
})
16+
headings = page.css('h1,h2,h3').map do |heading|
17+
{
18+
id: heading.attribute('id').to_s,
19+
text: heading.content,
20+
level: heading.name[1].to_i,
21+
children: []
22+
}
2423
end
2524

2625
[3, 2].each do |heading_level|

lib/cloud_controller/metrics/periodic_updater.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,8 @@ def update_webserver_stats
159159

160160
local_stats = Puma.stats_hash
161161
worker_count = local_stats[:booted_workers]
162-
worker_stats = []
163-
local_stats[:worker_status].each do |worker_status|
164-
worker_stats << {
162+
worker_stats = local_stats[:worker_status].map do |worker_status|
163+
{
165164
started_at: Time.parse(worker_status[:started_at]).utc.to_i,
166165
index: worker_status[:index],
167166
pid: worker_status[:pid],

0 commit comments

Comments
 (0)