Class: Swiftrail::QuickNimble::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/swiftrail/quicknimble/parser.rb

Defined Under Namespace

Classes: RegexMatch

Instance Method Summary collapse

Instance Method Details

#cases(test_name) ⇒ Object

find all occurences in string like this example: “C12345”



15
16
17
18
19
20
21
22
# File 'lib/swiftrail/quicknimble/parser.rb', line 15

def cases(test_name)
  test_name
    .split('__')
    .map { |group| group.split('_') }
    .select { |elements| elements.all? { |case_id| case_id =~ /C\d+/i } }
    .flatten
    .map { |case_id| case_id[1..-1] }
end

#extract_information(test_name) ⇒ Object

return RegexMatch result



10
11
12
# File 'lib/swiftrail/quicknimble/parser.rb', line 10

def extract_information(test_name)
  RegexMatch.new(cases(test_name), test_name)
end