Class: Pact::Provider::PrintMissingProviderStates
- Inherits:
-
Object
- Object
- Pact::Provider::PrintMissingProviderStates
- Defined in:
- lib/pact/provider/print_missing_provider_states.rb
Class Method Summary collapse
-
.call(missing_provider_states, output) ⇒ Object
Hash of consumer names to array of names of missing provider states.
- .colorize(string) ⇒ Object
- .create_provider_states_for(consumers) ⇒ Object
- .template_string ⇒ Object
- .text(missing_provider_states) ⇒ Object
Class Method Details
.call(missing_provider_states, output) ⇒ Object
Hash of consumer names to array of names of missing provider states
8 9 10 11 12 |
# File 'lib/pact/provider/print_missing_provider_states.rb', line 8 def self.call missing_provider_states, output if missing_provider_states.any? output.puts colorize(text(missing_provider_states)) end end |
.colorize(string) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/pact/provider/print_missing_provider_states.rb', line 14 def self.colorize string lines = string.split("\n") first_line = Rainbow(lines[0]).cyan.underline other_lines = Rainbow(lines[1..-1].join("\n")).cyan first_line + "\n" + other_lines end |
.create_provider_states_for(consumers) ⇒ Object
25 26 27 |
# File 'lib/pact/provider/print_missing_provider_states.rb', line 25 def self.create_provider_states_for consumers ERB.new(template_string).result(binding) end |
.template_string ⇒ Object
29 30 31 |
# File 'lib/pact/provider/print_missing_provider_states.rb', line 29 def self.template_string File.read(File.( '../../templates/provider_state.erb', __FILE__)) end |
.text(missing_provider_states) ⇒ Object
21 22 23 |
# File 'lib/pact/provider/print_missing_provider_states.rb', line 21 def self.text missing_provider_states create_provider_states_for(missing_provider_states) end |