Class: TuiTui::BoxChromeResolver
- Inherits:
-
Object
- Object
- TuiTui::BoxChromeResolver
- Defined in:
- lib/tui_tui/box_chrome_resolver.rb
Overview
Resolves the box-drawing glyph set for a live terminal.
Instance Method Summary collapse
-
#initialize(prober: BoxProber.new) ⇒ BoxChromeResolver
constructor
A new instance of BoxChromeResolver.
- #resolve(input:, output:, term_cols:, env: ENV) ⇒ Object
Constructor Details
#initialize(prober: BoxProber.new) ⇒ BoxChromeResolver
Returns a new instance of BoxChromeResolver.
9 10 11 |
# File 'lib/tui_tui/box_chrome_resolver.rb', line 9 def initialize(prober: BoxProber.new) @prober = prober end |
Instance Method Details
#resolve(input:, output:, term_cols:, env: ENV) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/tui_tui/box_chrome_resolver.rb', line 13 def resolve(input:, output:, term_cols:, env: ENV) forced = BoxChrome.from(env["TUITUI_BOX"]) return forced unless forced == :auto return BoxChrome::ASCII if term_cols < BoxChrome::MIN_PROBE_COLS BoxChrome.supported?(@prober.measure_all(input: input, output: output)) ? BoxChrome::UNICODE : BoxChrome::ASCII end |