Class: Minehunter::Intro Private

Inherits:
Object
  • Object
show all
Defined in:
lib/minehunter/intro.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

An intro screen content

Constant Summary collapse

INTRO =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[
  "     ,-*",
  "    (_) Minehunter",
  "",
  "Movement",
  "     [↑]        [w]",
  "  [←][↓][→]  [a][s][d]",
  "",
  "Actions",
  "  Toggle Flag  f",
  "  Uncover      space",
  "  Restart      r",
  "  Quit         q",
  "",
  "Press any key to start!"
].freeze

Class Method Summary collapse

Class Method Details

.heightInteger

The intro screen content height

Returns:

  • (Integer)


39
40
41
# File 'lib/minehunter/intro.rb', line 39

def self.height
  @height ||= INTRO.size
end

.renderString

Render intro screen content

Returns:

  • (String)


48
49
50
# File 'lib/minehunter/intro.rb', line 48

def self.render
  INTRO.join("\n")
end

.widthInteger

The maximum intro screen content width

Returns:

  • (Integer)


30
31
32
# File 'lib/minehunter/intro.rb', line 30

def self.width
  @width ||= INTRO.max_by(&:length).size
end