Class: RubySpriter::Utils::OutputFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_spriter/utils/output_formatter.rb

Overview

Console output formatting utilities

Constant Summary collapse

ICONS =
{
  success: '',
  error: '',
  warning: '⚠️',
  info: 'ℹ️',
  clean: '🧹',
  note: '📝'
}.freeze

Class Method Summary collapse

Class Method Details

.error(message) ⇒ Object

Print error message

Parameters:

  • message (String)

    Message to print



34
35
36
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 34

def error(message)
  puts "#{ICONS[:error]} #{message}"
end

.header(title, width = 60) ⇒ Object

Print section header

Parameters:

  • title (String)

    Section title

  • width (Integer) (defaults to: 60)

    Header width



20
21
22
23
24
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 20

def header(title, width = 60)
  puts "\n" + "=" * width
  puts title
  puts "=" * width + "\n"
end

.indent(message, indent = 6) ⇒ Object

Print indented message

Parameters:

  • message (String)

    Message to print

  • indent (Integer) (defaults to: 6)

    Number of spaces to indent



59
60
61
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 59

def indent(message, indent = 6)
  puts " " * indent + message
end

.info(message) ⇒ Object

Print info message

Parameters:

  • message (String)

    Message to print



46
47
48
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 46

def info(message)
  puts "#{ICONS[:info]} #{message}"
end

.note(message) ⇒ Object

Print note message

Parameters:

  • message (String)

    Message to print



52
53
54
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 52

def note(message)
  puts "#{ICONS[:note]} #{message}"
end

.success(message) ⇒ Object

Print success message

Parameters:

  • message (String)

    Message to print



28
29
30
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 28

def success(message)
  puts "#{ICONS[:success]} #{message}"
end

.warning(message) ⇒ Object

Print warning message

Parameters:

  • message (String)

    Message to print



40
41
42
# File 'lib/ruby_spriter/utils/output_formatter.rb', line 40

def warning(message)
  puts "#{ICONS[:warning]} #{message}"
end