Skip to content

Commit ad0acba

Browse files
committed
Code maintenance.
1 parent 4f3a5d9 commit ad0acba

File tree

10 files changed

+264
-256
lines changed

10 files changed

+264
-256
lines changed

.rubocop.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ plugins:
55
AllCops:
66
DisabledByDefault: true
77

8+
# Socketry specific rules:
9+
810
Layout/ConsistentBlankLineIndentation:
911
Enabled: true
1012

13+
Layout/BlockDelimiterSpacing:
14+
Enabled: true
15+
16+
# General Layout rules:
17+
1118
Layout/IndentationStyle:
1219
Enabled: true
1320
EnforcedStyle: tabs
@@ -37,9 +44,6 @@ Layout/BeginEndAlignment:
3744
Layout/RescueEnsureAlignment:
3845
Enabled: true
3946

40-
Layout/FirstHashElementIndentation:
41-
Enabled: true
42-
4347
Layout/ElseAlignment:
4448
Enabled: true
4549

@@ -53,6 +57,10 @@ Layout/CaseIndentation:
5357
Layout/CommentIndentation:
5458
Enabled: true
5559

60+
Layout/FirstHashElementIndentation:
61+
Enabled: true
62+
EnforcedStyle: consistent
63+
5664
Layout/EmptyLinesAroundClassBody:
5765
Enabled: true
5866

context/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ report = Memory::Report.new([
197197
sampler = Memory::Sampler.new
198198
sampler.run do
199199
# Your code here
200-
10000.times {"test string"}
200+
10000.times{"test string"}
201201
end
202202

203203
# Add samples to the custom report:
@@ -221,7 +221,7 @@ Reports can be exported as JSON for integration with other tools:
221221
``` ruby
222222
report = Memory.report do
223223
# Your code
224-
data = Array.new(1000) {{value: rand(1000)}}
224+
data = Array.new(1000){{value: rand(1000)}}
225225
end
226226

227227
# Export as JSON:

guides/getting-started/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ report = Memory::Report.new([
197197
sampler = Memory::Sampler.new
198198
sampler.run do
199199
# Your code here
200-
10000.times {"test string"}
200+
10000.times{"test string"}
201201
end
202202

203203
# Add samples to the custom report:
@@ -221,7 +221,7 @@ Reports can be exported as JSON for integration with other tools:
221221
``` ruby
222222
report = Memory.report do
223223
# Your code
224-
data = Array.new(1000) {{value: rand(1000)}}
224+
data = Array.new(1000){{value: rand(1000)}}
225225
end
226226

227227
# Export as JSON:

lib/memory/cache.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Cache
1717
# Initialize a new cache with empty lookup tables.
1818
def initialize
1919
@gem_guess_cache = Hash.new
20-
@location_cache = Hash.new {|h, k| h[k] = Hash.new.compare_by_identity}
20+
@location_cache = Hash.new{|h, k| h[k] = Hash.new.compare_by_identity}
2121
@class_name_cache = Hash.new.compare_by_identity
2222
@string_cache = Hash.new
2323
end

lib/memory/graph.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,12 @@ def as_json(*)
159159
},
160160
usage: @usage.as_json,
161161
}
162-
162+
163163
if @children&.any?
164164
json[:total_usage] = total_usage.as_json
165165
json[:children] = @children.transform_values(&:as_json)
166166
end
167-
167+
168168
return json
169169
end
170170

lib/memory/sampler.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def initialize(cache)
3232
@cache = cache
3333

3434
self.register_type(0x01, Allocation,
35-
packer: ->(instance){self.pack(instance.pack)},
36-
unpacker: ->(data){Allocation.unpack(@cache, self.unpack(data))},
35+
packer: ->(instance) {self.pack(instance.pack)},
36+
unpacker: ->(data) {Allocation.unpack(@cache, self.unpack(data))},
3737
)
3838

3939
self.register_type(0x02, Symbol)

releases.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## v0.11.1
44

5-
- Compresed `Memory::Graph::Node` JSON representation for leaf nodes.
5+
- Compressed `Memory::Graph::Node` JSON representation for leaf nodes.
66

77
## v0.11.0
88

0 commit comments

Comments
 (0)