Module: CukeSlicer::ExtractionHelpers

Includes:
FilterHelpers
Included in:
FileExtractor
Defined in:
lib/cuke_slicer/helpers/extraction_helpers.rb

Instance Method Summary collapse

Methods included from FilterHelpers

#apply_custom_filter, #filter_excluded_paths, #filter_excluded_tags, #filter_included_paths, #filter_included_tags

Methods included from MatchingHelpers

#and_filter_match, #filter_match, #matching_path?, #matching_tag?, #or_filter_match

Instance Method Details

#extract_runnable_block_elements(things, filters, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/cuke_slicer/helpers/extraction_helpers.rb', line 9

def extract_runnable_block_elements(things, filters, &block)
  Array.new.tap do |elements|
    things.each do |thing|
      if thing.is_a?(CukeModeler::Outline)
        elements.concat(thing.examples)
      else
        elements << thing
      end
    end

    filter_excluded_paths(elements, filters[:excluded_paths])
    filter_included_paths(elements, filters[:included_paths])
    filter_excluded_tags(elements, filters[:excluded_tags])
    filter_included_tags(elements, filters[:included_tags])

    apply_custom_filter(elements, &block)
  end
end

#extract_runnable_elements(things) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cuke_slicer/helpers/extraction_helpers.rb', line 28

def extract_runnable_elements(things)
  method_for_row_models = Gem.loaded_specs['cuke_modeler'].version.version[/^0/] ? :row_elements : :rows

  Array.new.tap do |elements|
    things.each do |thing|
      if thing.is_a?(CukeModeler::Example)
        # Slicing in order to remove the parameter row element
        elements.concat(thing.send(method_for_row_models).slice(1, thing.rows.count))
      else
        elements << thing
      end
    end
  end
end