Module: Hashira::CLI::Needs
- Defined in:
- lib/hashira/cli/needs.rb
Constant Summary collapse
- DIAGRAMS =
%i[dot mermaid].freeze
Class Method Summary collapse
- .check(options) ⇒ Object
- .drawing(mode, skip) ⇒ Object
- .gate(fail_on, skip) ⇒ Object
- .owner(kind) ⇒ Object
- .shaping(mode) ⇒ Object
Class Method Details
.check(options) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/hashira/cli/needs.rb', line 10 def check() mode = .mode skip = .skip drawing(mode, skip) gate(.fail_on, skip) shaping(mode) if .compact end |
.drawing(mode, skip) ⇒ Object
22 23 24 25 |
# File 'lib/hashira/cli/needs.rb', line 22 def drawing(mode, skip) return unless DIAGRAMS.include?(mode) && skip.include?(:coupling) raise(Hashira::Error, "--format #{mode} draws the coupling graph, but --skip coupling drops it") end |
.gate(fail_on, skip) ⇒ Object
27 28 29 30 31 |
# File 'lib/hashira/cli/needs.rb', line 27 def gate(fail_on, skip) blind = fail_on.find { skip.include?(owner(it)) } return unless blind raise(Hashira::Error, "--fail-on #{blind} needs the #{owner(blind)} analyzer, but --skip drops it") end |