Skip to content

Commit c6ee192

Browse files
committed
Fixes for rubocop update; stop using OpenStruct
1 parent bd83588 commit c6ee192

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

bin/innodb_log

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# frozen_string_literal: true
33

44
require "getoptlong"
5-
require "ostruct"
65
require "set"
76
require "innodb"
87

@@ -96,7 +95,14 @@ END_OF_USAGE
9695
exit exit_code
9796
end
9897

99-
@options = OpenStruct.new
98+
InnodbLogOptions = Struct.new(
99+
:log_files,
100+
:dump,
101+
:lsn,
102+
keyword_init: true
103+
)
104+
105+
@options = InnodbLogOptions.new
100106
@options.log_files = []
101107
@options.dump = false
102108
@options.lsn = nil

bin/innodb_space

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# frozen_string_literal: true
33

44
require "getoptlong"
5-
require "ostruct"
65
require "histogram/array"
76
require "innodb"
87

@@ -606,7 +605,7 @@ def space_lsn_age_illustrate(space)
606605

607606
puts "%12s ╰%-#{width}s╯" % ["", "─" * width]
608607

609-
_, lsn_freq = page_lsn.reject(&:nil?).histogram(colors.size, min: lsn_min, max: lsn_max)
608+
_, lsn_freq = page_lsn.compact.histogram(colors.size, min: lsn_min, max: lsn_max)
610609
lsn_freq_delta = lsn_freq.max - lsn_freq.min
611610

612611
lsn_age_histogram = "".dup
@@ -1484,7 +1483,26 @@ end
14841483
Signal.trap(name) { exit } if Signal.list.include?(name)
14851484
end
14861485

1487-
@options = OpenStruct.new
1486+
InnodbSpaceOptions = Struct.new(
1487+
:trace,
1488+
:system_space_file,
1489+
:system_space_tables,
1490+
:data_directory,
1491+
:space_file,
1492+
:table_name,
1493+
:index_name,
1494+
:page,
1495+
:record,
1496+
:level,
1497+
:list,
1498+
:fseg_id,
1499+
:describer,
1500+
:illustration_line_width,
1501+
:illustration_block_size,
1502+
keyword_init: true
1503+
)
1504+
1505+
@options = InnodbSpaceOptions.new
14881506
@options.trace = 0
14891507
@options.system_space_file = nil
14901508
@options.system_space_tables = false

innodb_ruby.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,5 @@ Gem::Specification.new do |s|
2929
s.add_development_dependency("rspec", "~> 3.11.0")
3030
s.add_development_dependency("rubocop", "~> 1.18")
3131
s.add_development_dependency("rubocop-rspec", "~> 2.4")
32+
s.metadata["rubygems_mfa_required"] = "false"
3233
end

lib/innodb/inode.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def allocated?
9999

100100
# Helper method to return an array of only non-nil fragment pages.
101101
def frag_array_pages
102-
frag_array.reject(&:nil?)
102+
frag_array.compact
103103
end
104104

105105
# Helper method to count non-nil fragment pages.

0 commit comments

Comments
 (0)