Class: SpecForge::Loader::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/spec_forge/loader/filter.rb

Overview

Filters blueprints and steps by path and tags

Applied after step processing to reduce the set of blueprints and steps that will be executed based on CLI options.

Instance Method Summary collapse

Constructor Details

#initialize(blueprints) ⇒ Filter

Creates a new filter for the given blueprints

Parameters:

  • blueprints (Array<Hash>)

    The blueprints to filter



19
20
21
# File 'lib/spec_forge/loader/filter.rb', line 19

def initialize(blueprints)
  @blueprints = blueprints
end

Instance Method Details

#run(path: nil, tags: [], skip_tags: []) ⇒ Array<Hash>

Applies filters to the blueprints

Parameters:

  • path (Pathname, nil) (defaults to: nil)

    Path prefix to filter by

  • tags (Array<String>) (defaults to: [])

    Tags that steps must have (OR logic)

  • skip_tags (Array<String>) (defaults to: [])

    Tags that exclude steps

Returns:

  • (Array<Hash>)

    Filtered blueprints



32
33
34
35
36
37
38
# File 'lib/spec_forge/loader/filter.rb', line 32

def run(path: nil, tags: [], skip_tags: [])
  filter_by_path(path)
  filter_by_tags(tags, skip_tags)
  remove_empty_blueprints

  @blueprints
end