Class: Contextizer::Collector
- Inherits:
-
Object
- Object
- Contextizer::Collector
- Defined in:
- lib/contextizer/collector.rb
Constant Summary collapse
- BASE_PROVIDERS =
[ Providers::Base::ProjectName, Providers::Base::Git, Providers::Base::FileSystem ].freeze
- LANGUAGE_MODULES =
{ ruby: Providers::Ruby, javascript: Providers::JavaScript }.freeze
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config:, target_path:, command:) ⇒ Collector
constructor
A new instance of Collector.
Constructor Details
#initialize(config:, target_path:, command:) ⇒ Collector
Returns a new instance of Collector.
20 21 22 23 24 25 26 27 28 |
# File 'lib/contextizer/collector.rb', line 20 def initialize(config:, target_path:, command:) @config = config @target_path = target_path @command = command @context = Context.new( target_path: target_path, command: @command ) end |
Class Method Details
.call(config:, target_path:, command:) ⇒ Object
16 17 18 |
# File 'lib/contextizer/collector.rb', line 16 def self.call(config:, target_path:, command:) new(config: config, target_path: target_path, command: command).call end |
Instance Method Details
#call ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/contextizer/collector.rb', line 30 def call stack = Analyzer.call(target_path: @target_path) @context.[:stack] = stack BASE_PROVIDERS.each do |provider_class| provider_class.call(context: @context, config: @config) end language_module = LANGUAGE_MODULES[stack[:language]] run_language_providers(language_module) if language_module puts "Collector: Collection complete. Found #{@context.files.count} files." @context end |