Method: HookApp#format_regex
- Defined in:
- lib/hook/hookapp.rb
#format_regex(options) ⇒ Object
Create a single regex for validation of an array by first char or full match.
11 12 13 14 15 |
# File 'lib/hook/hookapp.rb', line 11 def format_regex() fmt_rx_array = [] .map {|fmt| fmt_rx_array.push(fmt.sub(/^(.)(.*?)$/, '\1(\2)?')) } Regexp.new("^(#{fmt_rx_array.join('|')})$",'i') end |