Class: Cucumber::Wire::Plugin

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/wire/plugin.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Plugin

Returns a new instance of Plugin.



11
12
13
# File 'lib/cucumber/wire/plugin.rb', line 11

def initialize(config)
  @config = config
end

Instance Method Details

#create_connection(wire_file) ⇒ Object



22
23
24
# File 'lib/cucumber/wire/plugin.rb', line 22

def create_connection(wire_file)
  Connection.new(Configuration.from_file(wire_file))
end

#installObject



15
16
17
18
19
20
# File 'lib/cucumber/wire/plugin.rb', line 15

def install
  connections = Connections.new(wire_files.map { |f| create_connection(f) }, @config)
  config.filters << Filters::ActivateSteps.new(StepMatchSearch.new(connections.method(:step_matches), @config), @config)
  config.filters << AddHooksFilter.new(connections) unless @config.dry_run?
  config.register_snippet_generator Snippet::Generator.new(connections)
end

#wire_filesObject



26
27
28
29
# File 'lib/cucumber/wire/plugin.rb', line 26

def wire_files
  # TODO: change Cucumber's config object to allow us to get this information
  config.send(:require_dirs).map { |dir| Dir.glob("#{dir}/**/*.wire") }.flatten
end