Module: Takagi::Branding

Defined in:
lib/takagi/branding.rb

Overview

Branding and visual identity for Takagi

Constant Summary collapse

WAVE =

Japanese wave symbol - represents observables, events, and flow

''
LOGO =
"[#{WAVE}]"
LOGO_WITH_NAME =

Styled logo with name

"#{LOGO} Takagi"
<<~BANNER

    ╔═══════════════════════════════════╗
    ║                                   ║
    ║         [#{WAVE}] T A K A G I          ║
    ║                                   ║
    ║     CoAP Framework for Ruby       ║
    ║                                   ║
    ╚═══════════════════════════════════╝

BANNER
COMPACT_BANNER =

Compact banner for constrained terminals

<<~BANNER
  ═══════════════════════════════
    [#{WAVE}] Takagi CoAP Framework
  ═══════════════════════════════
BANNER
WAVE_LINE =

Wave pattern decorations

'' * 20

Class Method Summary collapse

Class Method Details

.error(message) ⇒ String

Error prefix with wave

Parameters:

  • message (String)

    Error message

Returns:

  • (String)

    Styled error



70
71
72
# File 'lib/takagi/branding.rb', line 70

def self.error(message)
  "#{LOGO} ERROR: #{message}"
end

.info(message) ⇒ String

Info prefix with wave

Parameters:

  • message (String)

    Info message

Returns:

  • (String)

    Styled info



84
85
86
# File 'lib/takagi/branding.rb', line 84

def self.info(message)
  "#{LOGO} #{message}"
end

.log(message) ⇒ String

Prefix for log messages

Parameters:

  • message (String)

    Log message

Returns:

  • (String)

    Message with logo prefix



39
40
41
# File 'lib/takagi/branding.rb', line 39

def self.log(message)
  "#{LOGO} #{message}"
end

Print startup banner

Parameters:

  • compact (Boolean) (defaults to: false)

    Use compact banner for smaller terminals



45
46
47
# File 'lib/takagi/branding.rb', line 45

def self.print_banner(compact: false)
  puts compact ? COMPACT_BANNER : BANNER
end

Print version info

Parameters:

  • version (String)

    Version string



51
52
53
# File 'lib/takagi/branding.rb', line 51

def self.print_version(version)
  puts "#{LOGO_WITH_NAME} v#{version}"
end

.section(title) ⇒ String

Styled section header

Parameters:

  • title (String)

    Section title

Returns:

  • (String)

    Styled header



58
59
60
61
62
63
64
65
# File 'lib/takagi/branding.rb', line 58

def self.section(title)
  <<~SECTION

    #{WAVE_LINE}
    #{LOGO} #{title}
    #{WAVE_LINE}
  SECTION
end

.success(message) ⇒ String

Success prefix with wave

Parameters:

  • message (String)

    Success message

Returns:

  • (String)

    Styled success



77
78
79
# File 'lib/takagi/branding.rb', line 77

def self.success(message)
  "#{LOGO}#{message}"
end