module Dex::UI

Constants

SpinGroup

TODO: this, better

Public Class Methods

ask(question, **kwargs) click to toggle source
# File lib/dex/ui.rb, line 36
def self.ask(question, **kwargs)
  Dex::UI::Prompt.ask(question, **kwargs)
end
confirm(question) click to toggle source
# File lib/dex/ui.rb, line 32
def self.confirm(question)
  Dex::UI::Prompt.confirm(question)
end
fmt(input, enable_color: true) click to toggle source
# File lib/dex/ui.rb, line 45
def self.fmt(input, enable_color: true)
  Dex::UI::Formatter.new(input).format(enable_color: enable_color)
end
frame(*args, &block) click to toggle source
# File lib/dex/ui.rb, line 49
def self.frame(*args, &block)
  Dex::UI::Frame.open(*args, &block)
end
glyph(handle) click to toggle source

TODO: test

# File lib/dex/ui.rb, line 18
def self.glyph(handle)
  Dex::UI::Glyph.lookup(handle)
end
log_output_to(path) { || ... } click to toggle source
# File lib/dex/ui.rb, line 61
def self.log_output_to(path)
  if Dex::UI::StdoutRouter.duplicate_output_to
    raise "multiple logs not allowed"
  end
  Dex::UI::StdoutRouter.duplicate_output_to = File.open(path, 'w')
  yield
ensure
  f = Dex::UI::StdoutRouter.duplicate_output_to
  f.close
  Dex::UI::StdoutRouter.duplicate_output_to = nil
end
raw() { || ... } click to toggle source
# File lib/dex/ui.rb, line 73
def self.raw
  prev = Thread.current[:no_dexui_frame_inset]
  Thread.current[:no_dexui_frame_inset] = true
  yield
ensure
  Thread.current[:no_dexui_frame_inset] = prev
end
resolve_color(input) click to toggle source

TODO: test

# File lib/dex/ui.rb, line 23
def self.resolve_color(input)
  case input
  when Symbol
    Dex::UI::Color.lookup(input)
  else
    input
  end
end
resolve_text(input) click to toggle source
# File lib/dex/ui.rb, line 40
def self.resolve_text(input)
  return input if input.nil?
  Dex::UI::Formatter.new(input).format
end
spinner(*args, &block) click to toggle source
# File lib/dex/ui.rb, line 53
def self.spinner(*args, &block)
  Dex::UI::Spinner.spin(*args, &block)
end
with_frame_color(color, &block) click to toggle source
# File lib/dex/ui.rb, line 57
def self.with_frame_color(color, &block)
  Dex::UI::Frame.with_frame_color_override(color, &block)
end