Module: PolishGeeks::DevTools::Commands::EmptyMethods::StringRefinements
- Defined in:
- lib/polish_geeks/dev_tools/commands/empty_methods/string_refinements.rb
Overview
Adds ability to check strings on specific regex matching
Constant Summary collapse
- COMMENTED_OR_EMPTY =
Regex to determine commented or empty string
/^\s*(|#.*)$/
- DEFINITION_OF_METHOD =
Regex to determine definition of method with ‘def’
/^\s*def\s+\w*(\s*|\s*#.*)$/
- EMPTY_ONE_LINE_METHOD =
Regex to determine empty one-line method
/^\s*def\s+.*;\s*end\s*(\s+|#.*|\n|$)$/
- END_REGEX =
Regex to determine end of method
/^\s*end(\.\w+(\s+|$)|\s*#.+|\s+|$)\s*/
- DEFINE_METHOD =
Regex to determine begin of method definition through define_method
'^\s*(define_method|define_singleton_method)'.freeze
- DEFINE_METHOD_WITH_DO_END =
Regex to determine definition of method with do-end block
/#{DEFINE_METHOD}(\s+|\().*do(\s*(\s*|.*\|\s*))(\s*|#.*)$/
- EMPTY_ONE_LINE_DEFINE_METHODS =
Regex to determine empty one-line methods
/#{DEFINE_METHOD}.+\s+({\s*)\s*((\|.*\|\s+})|})(\s+|\n|#|$|\.)/