rich-ruby 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/rich.rb CHANGED
@@ -1,108 +1,108 @@
1
- # frozen_string_literal: true
2
-
3
- # Rich - A Ruby library for rich text and beautiful formatting in the terminal.
4
- #
5
- # Rich provides a simple API for adding color and style to terminal output.
6
- # It supports true color (24-bit), 256-color, and 16-color terminals with
7
- # automatic fallback. Full Windows Console API support included.
8
- #
9
- # @example Basic usage
10
- # require 'rich'
11
- #
12
- # Rich.print("[bold red]Hello[/] [green]World[/]!")
13
- # Rich.print("[italic blue on white]Styled text[/]")
14
- #
15
- # @example Using the Console directly
16
- # console = Rich::Console.new
17
- # console.print("Hello", style: "bold magenta")
18
- #
19
- # @example Tables
20
- # table = Rich::Table.new(title: "Users")
21
- # table.add_column("Name")
22
- # table.add_column("Age")
23
- # table.add_row("Alice", "30")
24
- # Rich.print(table)
25
-
26
- require_relative "rich/version"
27
- require_relative "rich/color_triplet"
28
- require_relative "rich/_palettes"
29
- require_relative "rich/color"
30
- require_relative "rich/terminal_theme"
31
- require_relative "rich/style"
32
- require_relative "rich/cells"
33
- require_relative "rich/control"
34
- require_relative "rich/segment"
35
- require_relative "rich/text"
36
- require_relative "rich/markup"
37
- require_relative "rich/box"
38
- require_relative "rich/panel"
39
- require_relative "rich/table"
40
- require_relative "rich/progress"
41
- require_relative "rich/tree"
42
- require_relative "rich/json"
43
- require_relative "rich/layout"
44
- require_relative "rich/syntax"
45
- require_relative "rich/markdown"
46
- require_relative "rich/win32_console" if Gem.win_platform?
47
-
48
- module Rich
49
- class << self
50
- # Global console instance
51
- # @return [Console, nil]
52
- attr_accessor :console
53
-
54
- # Get or create the global console
55
- # @return [Console]
56
- def get_console
57
- @console ||= Console.new
58
- end
59
-
60
- # Reconfigure the global console
61
- # @param kwargs [Hash] Console options
62
- # @return [void]
63
- def reconfigure(**kwargs)
64
- @console = Console.new(**kwargs)
65
- end
66
-
67
- # Print to the console with markup support
68
- # @param objects [Array] Objects to print
69
- # @param sep [String] Separator between objects
70
- # @param end_str [String] End of line string
71
- # @param style [String, Style, nil] Style to apply
72
- # @param highlight [Boolean] Enable highlighting
73
- # @return [void]
74
- def print(*objects, sep: " ", end_str: "\n", style: nil, highlight: true)
75
- get_console.print(*objects, sep: sep, end_str: end_str, style: style, highlight: highlight)
76
- end
77
-
78
- # Print JSON with syntax highlighting
79
- # @param json [String, nil] JSON string
80
- # @param data [Object] Object to convert to JSON
81
- # @param indent [Integer] Indentation level
82
- # @return [void]
83
- def print_json(json = nil, data: nil, indent: 2)
84
- get_console.print_json(json, data: data, indent: indent)
85
- end
86
-
87
- # Inspect an object and print its details
88
- # @param obj [Object] Object to inspect
89
- # @param title [String, nil] Title
90
- # @param methods [Boolean] Show methods
91
- # @param docs [Boolean] Show documentation
92
- # @return [void]
93
- def inspect(obj, title: nil, methods: false, docs: true)
94
- get_console.inspect(obj, title: title, methods: methods, docs: docs)
95
- end
96
-
97
- # Create a rule/separator line
98
- # @param title [String] Title text
99
- # @param style [String] Style for the rule
100
- # @return [void]
101
- def rule(title = "", style: "rule.line")
102
- get_console.rule(title, style: style)
103
- end
104
- end
105
- end
106
-
107
- # Auto-require Console after base modules are loaded
108
- require_relative "rich/console"
1
+ # frozen_string_literal: true
2
+
3
+ # Rich - A Ruby library for rich text and beautiful formatting in the terminal.
4
+ #
5
+ # Rich provides a simple API for adding color and style to terminal output.
6
+ # It supports true color (24-bit), 256-color, and 16-color terminals with
7
+ # automatic fallback. Full Windows Console API support included.
8
+ #
9
+ # @example Basic usage
10
+ # require 'rich'
11
+ #
12
+ # Rich.print("[bold red]Hello[/] [green]World[/]!")
13
+ # Rich.print("[italic blue on white]Styled text[/]")
14
+ #
15
+ # @example Using the Console directly
16
+ # console = Rich::Console.new
17
+ # console.print("Hello", style: "bold magenta")
18
+ #
19
+ # @example Tables
20
+ # table = Rich::Table.new(title: "Users")
21
+ # table.add_column("Name")
22
+ # table.add_column("Age")
23
+ # table.add_row("Alice", "30")
24
+ # Rich.print(table)
25
+
26
+ require_relative "rich/version"
27
+ require_relative "rich/color_triplet"
28
+ require_relative "rich/_palettes"
29
+ require_relative "rich/color"
30
+ require_relative "rich/terminal_theme"
31
+ require_relative "rich/style"
32
+ require_relative "rich/cells"
33
+ require_relative "rich/control"
34
+ require_relative "rich/segment"
35
+ require_relative "rich/text"
36
+ require_relative "rich/markup"
37
+ require_relative "rich/box"
38
+ require_relative "rich/panel"
39
+ require_relative "rich/table"
40
+ require_relative "rich/progress"
41
+ require_relative "rich/tree"
42
+ require_relative "rich/json"
43
+ require_relative "rich/layout"
44
+ require_relative "rich/syntax"
45
+ require_relative "rich/markdown"
46
+ require_relative "rich/win32_console" if Gem.win_platform?
47
+
48
+ module Rich
49
+ class << self
50
+ # Global console instance
51
+ # @return [Console, nil]
52
+ attr_accessor :console
53
+
54
+ # Get or create the global console
55
+ # @return [Console]
56
+ def get_console
57
+ @console ||= Console.new
58
+ end
59
+
60
+ # Reconfigure the global console
61
+ # @param kwargs [Hash] Console options
62
+ # @return [void]
63
+ def reconfigure(**kwargs)
64
+ @console = Console.new(**kwargs)
65
+ end
66
+
67
+ # Print to the console with markup support
68
+ # @param objects [Array] Objects to print
69
+ # @param sep [String] Separator between objects
70
+ # @param end_str [String] End of line string
71
+ # @param style [String, Style, nil] Style to apply
72
+ # @param highlight [Boolean] Enable highlighting
73
+ # @return [void]
74
+ def print(*objects, sep: " ", end_str: "\n", style: nil, highlight: true)
75
+ get_console.print(*objects, sep: sep, end_str: end_str, style: style, highlight: highlight)
76
+ end
77
+
78
+ # Print JSON with syntax highlighting
79
+ # @param json [String, nil] JSON string
80
+ # @param data [Object] Object to convert to JSON
81
+ # @param indent [Integer] Indentation level
82
+ # @return [void]
83
+ def print_json(json = nil, data: nil, indent: 2)
84
+ get_console.print_json(json, data: data, indent: indent)
85
+ end
86
+
87
+ # Inspect an object and print its details
88
+ # @param obj [Object] Object to inspect
89
+ # @param title [String, nil] Title
90
+ # @param methods [Boolean] Show methods
91
+ # @param docs [Boolean] Show documentation
92
+ # @return [void]
93
+ def inspect(obj, title: nil, methods: false, docs: true)
94
+ get_console.inspect(obj, title: title, methods: methods, docs: docs)
95
+ end
96
+
97
+ # Create a rule/separator line
98
+ # @param title [String] Title text
99
+ # @param style [String] Style for the rule
100
+ # @return [void]
101
+ def rule(title = "", style: "rule.line")
102
+ get_console.rule(title, style: style)
103
+ end
104
+ end
105
+ end
106
+
107
+ # Auto-require Console after base modules are loaded
108
+ require_relative "rich/console"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rich-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - tigel-agm
@@ -24,19 +24,19 @@ dependencies:
24
24
  - !ruby/object:Gem::Version
25
25
  version: '5.0'
26
26
  - !ruby/object:Gem::Dependency
27
- name: rbs
27
+ name: rake
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: '3.0'
32
+ version: '13.0'
33
33
  type: :development
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '3.0'
39
+ version: '13.0'
40
40
  description: "A pure Ruby implementation of rich terminal output with full Windows
41
41
  Console API \nsupport via Fiddle. Features include styled text, tables, panels,
42
42
  progress bars,\nspinners, live display, syntax highlighting, and more. No external
@@ -45,8 +45,16 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - CHANGELOG.md
48
49
  - LICENSE
49
50
  - README.md
51
+ - docs/architecture.md
52
+ - docs/cheat-sheet.md
53
+ - docs/customization.md
54
+ - docs/how-to-use.md
55
+ - docs/test-report.md
56
+ - docs/troubleshooting.md
57
+ - docs/windows-notes.md
50
58
  - examples/demo.rb
51
59
  - examples/showcase.rb
52
60
  - examples/smoke_test.rb
@@ -81,8 +89,10 @@ homepage: https://github.com/tigel-agm/rich-ruby
81
89
  licenses:
82
90
  - MIT
83
91
  metadata:
84
- homepage_uri: https://github.com/tigel-agm/rich-ruby
85
92
  source_code_uri: https://github.com/tigel-agm/rich-ruby
93
+ changelog_uri: https://github.com/tigel-agm/rich-ruby/blob/main/CHANGELOG.md
94
+ bug_tracker_uri: https://github.com/tigel-agm/rich-ruby/issues
95
+ documentation_uri: https://github.com/tigel-agm/rich-ruby#readme
86
96
  windows_compatible: 'true'
87
97
  msvc_compatible: 'true'
88
98
  rubygems_mfa_required: 'true'