Skip to content

Commit 420851c

Browse files
committed
Unify check_row_index
1 parent db014cd commit 420851c

3 files changed

Lines changed: 6 additions & 12 deletions

File tree

lib/unicode_plot/barplot.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,6 @@ def print_row(out, row_index)
6767
end
6868
[max, i]
6969
end
70-
71-
private def check_row_index(row_index)
72-
unless 0 <= row_index && row_index < n_rows
73-
raise ArgumentError, "row_index is out of range"
74-
end
75-
end
7670
end
7771

7872
module_function def barplot(*args,

lib/unicode_plot/boxplot.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ def print_row(out, row_index)
8989
val.round(half: :even).clamp(1, @width).to_i
9090
end
9191
end
92-
93-
private def check_row_index(row_index)
94-
unless 0 <= row_index && row_index < n_rows
95-
raise ArgumentError, "row_index out of bounds"
96-
end
97-
end
9892
end
9993

10094
module_function def boxplot(*args,

lib/unicode_plot/plot.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,11 @@ def to_s
136136
end
137137
margin
138138
end
139+
140+
private def check_row_index(row_index)
141+
unless 0 <= row_index && row_index < n_rows
142+
raise ArgumentError, "row_index out of bounds"
143+
end
144+
end
139145
end
140146
end

0 commit comments

Comments
 (0)