Class: PryTheme::Preview

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-theme/preview.rb

Instance Method Summary collapse

Constructor Details

#initialize(theme) ⇒ Preview

Returns a new instance of Preview.



4
5
6
# File 'lib/pry-theme/preview.rb', line 4

def initialize(theme)
  @theme = theme
end

Instance Method Details



29
30
31
32
33
34
35
36
# File 'lib/pry-theme/preview.rb', line 29

def banner(msg)
  safe_width = 80
  delimiter = ('-' * safe_width)
  [delimiter,
   Pry::Helpers::Text.bold(msg.center(safe_width)),
   delimiter
  ].join("\n") + "\n"
end

#descriptionObject



21
22
23
# File 'lib/pry-theme/preview.rb', line 21

def description
  @theme.description
end

#headerObject



25
26
27
# File 'lib/pry-theme/preview.rb', line 25

def header
  Pry::Helpers::Text.bold("#{ @theme.name } / #{ @theme.color_model }")
end

#longObject



17
18
19
# File 'lib/pry-theme/preview.rb', line 17

def long
  long_snippet
end

#shortObject



8
9
10
11
12
13
14
15
# File 'lib/pry-theme/preview.rb', line 8

def short
  cur_theme = ThemeList.current_theme
  @theme.activate
  [header, description, '--', short_snippet].join("\n")
ensure
  @theme.disable
  cur_theme.activate
end