Class: Daigaku::Views::Splash

Inherits:
Object
  • Object
show all
Includes:
Daigaku::Views
Defined in:
lib/daigaku/views/splash.rb

Instance Method Summary collapse

Methods included from Daigaku::Views

#reset_menu_position

Constructor Details

#initializeSplash

Returns a new instance of Splash.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/daigaku/views/splash.rb', line 6

def initialize
  title    = 'DAIGAKU'
  subtitle = 'Learning the Ruby programming language dead easy.'
  panel    = default_window

  lines.times do |line|
    panel.setpos(line, 0)
    panel.red(' ' * cols, Curses::A_STANDOUT)
  end

  panel.setpos((lines / 4), (cols - title.length) / 2)
  panel.red(title, Curses::A_STANDOUT)
  panel.refresh

  sleep 0.5

  ruby_ascii_art.each_with_index do |line, index|
    panel.setpos(lines / 4 + 2 + index, (cols - line.length) / 2)
    panel.red(line, Curses::A_STANDOUT)
    sleep 0.06
    panel.refresh
  end

  panel.setpos(lines / 4 + 11, (cols - subtitle.length) / 2)

  subtitle.chars do |char|
    panel.red(char, Curses::A_STANDOUT)
    panel.refresh
    sleep 0.02
  end

  sleep 2.5

  close_screen
end

Instance Method Details

#ruby_ascii_artObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/daigaku/views/splash.rb', line 42

def ruby_ascii_art
  [
    '  ___________  ',
    ' /.\\  /.\\  /.\\ ',
    '/___\\/___\\/___\\',
    ' \\  \\  . / . / ',
    '   \\ \\ ./ ./   ',
    '    \\\\ / /    ',
    '      \\./     '
  ]
end