Module: Cl::Regex

Included in:
Cl, Help::Format::Opt, Opt, Opts::Validate::Validator
Defined in:
lib/cl/helper.rb

Instance Method Summary collapse

Instance Method Details

#format_regex(str) ⇒ Object



15
16
17
18
# File 'lib/cl/helper.rb', line 15

def format_regex(str)
  return str unless str.is_a?(Regexp)
  "/#{str.to_s.sub('(?-mix:', '').sub(/\)$/, '')}/"
end