Skip to content

Commit 983c972

Browse files
committed
refactor: move regex constants to the appropriate location and mark as private
1 parent a93685b commit 983c972

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/command_line_boss.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ def succeeded? = @error_messages.empty?
117117
#
118118
def failed? = !succeeded?
119119

120-
VALIDATION_METHOD_REGEXP = /^validate_(.+)$/
121-
122-
DEFINITION_METHOD_REGEXP = /^define_(.+)_option$/
123-
124120
private
125121

126122
# This is how you should add an error message to the error_messages array
@@ -208,6 +204,9 @@ def parse_options
208204
#
209205
def parse_arguments; end
210206

207+
VALIDATION_METHOD_REGEXP = /^validate_(.+)$/
208+
private_constant :VALIDATION_METHOD_REGEXP
209+
211210
# Validate the command line options and remaining arguments
212211
#
213212
# Calls all validation methods defined by this class. Validation
@@ -224,6 +223,9 @@ def validate
224223
private_methods.select { |m| m.to_s.match?(VALIDATION_METHOD_REGEXP) }.each { |m| send(m) }
225224
end
226225

226+
DEFINITION_METHOD_REGEXP = /^define_(.+)_option$/
227+
private_constant :DEFINITION_METHOD_REGEXP
228+
227229
# Set the default values for the command line options
228230
#
229231
# @return [void]

0 commit comments

Comments
 (0)