Module: Karst::Access::PopulationConfigSnippet

Defined in:
lib/karst/access/population_config_snippet.rb

Overview

Renders a developer's curated selection of Karst::Access::PopulationDiscovery::Candidate into a Ruby config snippet they can copy into their own Karst.configure block. Karst never writes to the host application's files on its own -- the developer stays in control of what actually gets committed (see README "Curation / persistence").

Constant Summary collapse

Result =

wired is the subset actually rendered into code (every selected candidate whose model matches a configured principal source). unwired is every selected candidate that is not wired into anything yet -- present so the UI can say so honestly instead of silently dropping a selection (see README "Principal vs artifact populations": this release only wires principal populations).

Value.define(:code, :wired, :unwired)

Class Method Summary collapse

Class Method Details

.generate(candidates) ⇒ Object



23
24
25
26
27
# File 'lib/karst/access/population_config_snippet.rb', line 23

def generate(candidates)
  unique = candidates.uniq { |candidate| [candidate.model_name, candidate.method_name] }
  wired, unwired = unique.partition(&:principal_source)
  Result.new(code: render(wired), wired: wired, unwired: unwired)
end