Class: RevealCK::Commands::ServeUI

Inherits:
Object
  • Object
show all
Defined in:
lib/reveal-ck/commands/serve_ui.rb

Overview

This object represents controls the “User Interface” of the serve command.

Constant Summary collapse

PREFIXES =
{
  default: '[ reveal-ck ]',
  problem: '[  problem  ]',
  rebuild: '[  rebuild  ]',
  reload: '[   reload  ]'
}.freeze

Instance Method Summary collapse

Instance Method Details

#blank(type = nil) ⇒ Object



30
31
32
33
# File 'lib/reveal-ck/commands/serve_ui.rb', line 30

def blank(type = nil)
  prefix = PREFIXES[type] || ''
  puts prefix.to_s
end

#message(s, type = nil) ⇒ Object



21
22
23
24
# File 'lib/reveal-ck/commands/serve_ui.rb', line 21

def message(s, type = nil)
  prefix = prefix_for(type)
  puts "#{prefix} #{s}"
end

#prefix_for(type = nil) ⇒ Object



26
27
28
# File 'lib/reveal-ck/commands/serve_ui.rb', line 26

def prefix_for(type = nil)
  PREFIXES[type] || PREFIXES[:default]
end

#problem(general_problem, specific_error) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/reveal-ck/commands/serve_ui.rb', line 13

def problem(general_problem, specific_error)
  blank :problem
  message general_problem, :problem
  blank :problem
  message specific_error, :problem
  blank :problem
end

#separatorObject



35
36
37
# File 'lib/reveal-ck/commands/serve_ui.rb', line 35

def separator
  puts '------------------------------------------------------------'
end