Class: PryTheme::Preview
- Inherits:
-
Object
- Object
- PryTheme::Preview
- Defined in:
- lib/pry-theme/preview.rb
Instance Method Summary collapse
- #banner(msg) ⇒ Object
- #description ⇒ Object
- #header ⇒ Object
-
#initialize(theme) ⇒ Preview
constructor
A new instance of Preview.
- #long ⇒ Object
- #short ⇒ Object
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
#banner(msg) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/pry-theme/preview.rb', line 29 def (msg) safe_width = 80 delimiter = ('-' * safe_width) [delimiter, Pry::Helpers::Text.bold(msg.center(safe_width)), delimiter ].join("\n") + "\n" end |
#description ⇒ Object
21 22 23 |
# File 'lib/pry-theme/preview.rb', line 21 def description @theme.description end |
#header ⇒ Object
25 26 27 |
# File 'lib/pry-theme/preview.rb', line 25 def header Pry::Helpers::Text.bold("#{ @theme.name } / #{ @theme.color_model }") end |
#long ⇒ Object
17 18 19 |
# File 'lib/pry-theme/preview.rb', line 17 def long long_snippet end |
#short ⇒ Object
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 |