Module: RubyRich

Defined in:
lib/ruby_rich.rb,
lib/ruby_rich/live.rb,
lib/ruby_rich/text.rb,
lib/ruby_rich/tree.rb,
lib/ruby_rich/event.rb,
lib/ruby_rich/panel.rb,
lib/ruby_rich/print.rb,
lib/ruby_rich/table.rb,
lib/ruby_rich/theme.rb,
lib/ruby_rich/dialog.rb,
lib/ruby_rich/layout.rb,
lib/ruby_rich/status.rb,
lib/ruby_rich/syntax.rb,
lib/ruby_rich/columns.rb,
lib/ruby_rich/console.rb,
lib/ruby_rich/sidebar.rb,
lib/ruby_rich/version.rb,
lib/ruby_rich/composer.rb,
lib/ruby_rich/markdown.rb,
lib/ruby_rich/terminal.rb,
lib/ruby_rich/viewport.rb,
lib/ruby_rich/ansi_code.rb,
lib/ruby_rich/app_shell.rb,
lib/ruby_rich/attachment.rb,
lib/ruby_rich/tool_block.rb,
lib/ruby_rich/transcript.rb,
lib/ruby_rich/agent_shell.rb,
lib/ruby_rich/line_editor.rb,
lib/ruby_rich/slash_input.rb,
lib/ruby_rich/progress_bar.rb,
lib/ruby_rich/focus_manager.rb,
lib/ruby_rich/progress_manager.rb

Overview

Define main module

Defined Under Namespace

Modules: Event Classes: AgentShell, AnsiCode, AppShell, Attachment, CacheRender, Columns, Composer, Console, Dialog, Error, FocusManager, Layout, LineEditor, Live, Markdown, Panel, ProgressBar, ProgressManager, RichPrint, RichText, Sidebar, SlashInput, Status, Syntax, Table, Terminal, Theme, ToolBlock, Transcript, Tree, Viewport

Constant Summary collapse

VERSION =
"0.4.3"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.columns(total_width: 80, gutter_width: 2) ⇒ Object

Provide a convenient method to create multi-column layout



78
79
80
# File 'lib/ruby_rich.rb', line 78

def self.columns(total_width: 80, gutter_width: 2)
  Columns.new(total_width: total_width, gutter_width: gutter_width)
end

.consoleObject

Provide a convenient method to create console instance



48
49
50
# File 'lib/ruby_rich.rb', line 48

def self.console
  @console ||= Console.new
end

.loggerObject



90
91
92
93
94
# File 'lib/ruby_rich.rb', line 90

def self.logger
  @logger ||= Logger.new($stdout).tap do |log|
    log.progname = "Ruby Rich"
  end
end

.logger=(logger) ⇒ Object



87
88
89
# File 'lib/ruby_rich.rb', line 87

def self.logger=(logger)
  @logger = logger
end

.markdown(text, options = {}) ⇒ Object

Provide a convenient method to render Markdown



68
69
70
# File 'lib/ruby_rich.rb', line 68

def self.markdown(text, options = {})
  Markdown.render(text, options)
end

.status(type, **options) ⇒ Object

Provide a convenient method to create status indicator



83
84
85
# File 'lib/ruby_rich.rb', line 83

def self.status(type, **options)
  Status.indicator(type, **options)
end

.syntax(code, language = nil, theme: :default) ⇒ Object

Provide a convenient method for syntax highlighting



63
64
65
# File 'lib/ruby_rich.rb', line 63

def self.syntax(code, language = nil, theme: :default)
  Syntax.highlight(code, language, theme: theme)
end

.table(border_style: :none) ⇒ Object

Provide a convenient method to create table



58
59
60
# File 'lib/ruby_rich.rb', line 58

def self.table(border_style: :none)
  Table.new(border_style: border_style)
end

.text(content = '') ⇒ Object

Provide a convenient method to create rich text



53
54
55
# File 'lib/ruby_rich.rb', line 53

def self.text(content = '')
  RichText.new(content)
end

.tree(root_name = 'Root', style: :default) ⇒ Object

Provide a convenient method to create tree structure



73
74
75
# File 'lib/ruby_rich.rb', line 73

def self.tree(root_name = 'Root', style: :default)
  Tree.new(root_name, style: style)
end

Instance Method Details



57
58
59
# File 'lib/ruby_rich/print.rb', line 57

def print(*args)
  $rich_print.print(*args)
end