Class: Fatty::AcceptEnv
- Inherits:
-
Object
- Object
- Fatty::AcceptEnv
- Defined in:
- lib/fatty/accept_env.rb
Instance Attribute Summary collapse
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Instance Method Summary collapse
-
#initialize(session:) ⇒ AcceptEnv
constructor
A new instance of AcceptEnv.
- #markdown(text) ⇒ Object
- #progress(**opts) ⇒ Object
- #terminal ⇒ Object
Constructor Details
#initialize(session:) ⇒ AcceptEnv
Returns a new instance of AcceptEnv.
10 11 12 13 |
# File 'lib/fatty/accept_env.rb', line 10 def initialize(session:) @session = session @progress = nil end |
Instance Attribute Details
#session ⇒ Object (readonly)
Returns the value of attribute session.
8 9 10 |
# File 'lib/fatty/accept_env.rb', line 8 def session @session end |
Instance Method Details
#markdown(text) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/fatty/accept_env.rb', line 23 def markdown(text) md = Fatty::Markdown.render( text, width: terminal.screen.cols, palette: terminal.renderer.palette, ) session.append_output(md) end |
#progress(**opts) ⇒ Object
19 20 21 |
# File 'lib/fatty/accept_env.rb', line 19 def progress(**opts) @progress ||= Fatty::Terminal::Progress.new(terminal: terminal, **opts) end |
#terminal ⇒ Object
15 16 17 |
# File 'lib/fatty/accept_env.rb', line 15 def terminal session.terminal end |