tint_me 1.0.0

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.
Files changed (41) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop_todo.yml +7 -0
  3. data/.serena/project.yml +68 -0
  4. data/.simplecov +24 -0
  5. data/.yardopts +6 -0
  6. data/AGENTS.md +60 -0
  7. data/CHANGELOG.md +29 -0
  8. data/CLAUDE.md +1 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +175 -0
  11. data/RELEASING.md +202 -0
  12. data/Rakefile +18 -0
  13. data/benchmark/2025-09-08-style-caching-optimization/01_baseline_results.txt +39 -0
  14. data/benchmark/2025-09-08-style-caching-optimization/02_with_full_caching_results.txt +54 -0
  15. data/benchmark/2025-09-08-style-caching-optimization/03_prefix_only_caching_results.txt +107 -0
  16. data/benchmark/2025-09-08-style-caching-optimization/04_baseline_vs_optimized_analysis.txt +65 -0
  17. data/benchmark/2025-09-08-style-caching-optimization/05_caching_approaches_comparison.txt +59 -0
  18. data/benchmark/2025-09-08-style-caching-optimization/06_append_operator_results.txt +107 -0
  19. data/benchmark/2025-09-08-style-caching-optimization/07_string_concatenation_comparison.txt +66 -0
  20. data/benchmark/2025-09-08-style-caching-optimization/08_with_freeze_optimization_results.txt +107 -0
  21. data/benchmark/2025-09-08-style-caching-optimization/09_freeze_optimization_analysis.txt +49 -0
  22. data/benchmark/2025-09-08-style-caching-optimization/10_constant_access_results.txt +107 -0
  23. data/benchmark/2025-09-08-style-caching-optimization/11_constant_vs_cache_analysis.txt +74 -0
  24. data/benchmark/2025-09-08-style-caching-optimization/12_empty_prefix_analysis.txt +81 -0
  25. data/benchmark/2025-09-08-style-caching-optimization/13_nil_check_optimization_results.txt +107 -0
  26. data/benchmark/2025-09-08-style-caching-optimization/14_nil_vs_empty_check_analysis.txt +81 -0
  27. data/benchmark/2025-09-08-style-caching-optimization/README.md +45 -0
  28. data/benchmark/2025-09-08-style-caching-optimization/benchmark_script.rb +180 -0
  29. data/docs/agents/git-pr.md +298 -0
  30. data/docs/agents/languages.md +388 -0
  31. data/docs/agents/rubocop.md +55 -0
  32. data/lib/tint_me/error.rb +6 -0
  33. data/lib/tint_me/sgr_builder.rb +259 -0
  34. data/lib/tint_me/style/schema.rb +22 -0
  35. data/lib/tint_me/style/types.rb +50 -0
  36. data/lib/tint_me/style.rb +286 -0
  37. data/lib/tint_me/version.rb +8 -0
  38. data/lib/tint_me.rb +62 -0
  39. data/mise.toml +5 -0
  40. data/sig/tint_me.rbs +61 -0
  41. metadata +131 -0
data/lib/tint_me.rb ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "zeitwerk"
4
+ require_relative "tint_me/version"
5
+
6
+ # TIntMe - Functional terminal text styling with composable ANSI colors and effects
7
+ #
8
+ # TIntMe provides an elegant, functional API for terminal text styling using ANSI escape codes.
9
+ # It features immutable Style objects that can be composed using the >> operator, supporting
10
+ # standard colors, hex values, and comprehensive text effects.
11
+ #
12
+ # @example Basic styling
13
+ # require "tint_me"
14
+ #
15
+ # # Create styles
16
+ # red = TIntMe[foreground: :red]
17
+ # bold = TIntMe[bold: true]
18
+ #
19
+ # # Apply styling
20
+ # puts red.call("Error!")
21
+ # puts bold["Important"]
22
+ #
23
+ # @example Style composition
24
+ # base = TIntMe[foreground: :blue]
25
+ # emphasis = TIntMe[bold: true, underline: true]
26
+ # styled = base >> emphasis
27
+ # puts styled.call("Highlighted text")
28
+ #
29
+ # @example Hex colors
30
+ # custom = TIntMe[foreground: "#FF6B35", background: "#F7931E"]
31
+ # puts custom.call("Custom colors")
32
+ #
33
+ # @see Style
34
+ # @see Style#initialize
35
+ # @author OZAWA Sakuro
36
+ module TIntMe
37
+ # Setup Zeitwerk loader
38
+ loader = Zeitwerk::Loader.for_gem
39
+ loader.inflector.inflect(
40
+ "tint_me" => "TIntMe",
41
+ "sgr_builder" => "SGRBuilder"
42
+ )
43
+ loader.ignore("#{__dir__}/tint_me/version.rb")
44
+ loader.setup
45
+
46
+ # Shortcut method to create a Style instance with the given options
47
+ #
48
+ # This is a convenience method that passes all arguments directly to Style.new.
49
+ # Accepts the same keyword arguments as Style#initialize.
50
+ #
51
+ # @return [Style] A new Style instance
52
+ # @see Style#initialize
53
+ # @example Basic usage
54
+ # blue = TIntMe[foreground: :blue]
55
+ # bold_red = TIntMe[foreground: :red, bold: true]
56
+ # puts blue.call("Hello") # => blue "Hello"
57
+ # @example Immediate styling
58
+ # puts TIntMe[foreground: :green, italic: true]["Success!"]
59
+ def self.[](...)
60
+ Style.new(...)
61
+ end
62
+ end
data/mise.toml ADDED
@@ -0,0 +1,5 @@
1
+ [tools]
2
+ ruby = "3.2"
3
+
4
+ [env]
5
+ _.path = ["bin", "exe"]
data/sig/tint_me.rbs ADDED
@@ -0,0 +1,61 @@
1
+ module TIntMe
2
+ VERSION: String
3
+
4
+ # Creates a new Style instance with the given options
5
+ def self.[]: (
6
+ ?foreground: Style::color_value?,
7
+ ?background: Style::color_value?,
8
+ ?bold: Style::boolean_value?,
9
+ ?faint: Style::boolean_value?,
10
+ ?italic: Style::boolean_value?,
11
+ ?underline: Style::underline_value?,
12
+ ?overline: Style::boolean_value?,
13
+ ?blink: Style::boolean_value?,
14
+ ?inverse: Style::boolean_value?,
15
+ ?conceal: Style::boolean_value?
16
+ ) -> Style
17
+
18
+ class Style
19
+ type color_value = :red | :green | :blue | :cyan | :yellow | :magenta | :gray | :white | :black | :default | :reset | String
20
+ type underline_value = bool | :double | :reset
21
+ type boolean_value = bool | :reset
22
+ type style_attribute = :red | :green | :blue | :cyan | :yellow | :magenta | :gray | :white | :black |
23
+ :underline | :double_underline | :overline | :bold | :faint | :blink | :italic | :inverse | :conceal |
24
+ String | nil
25
+
26
+ attr_reader foreground: color_value?
27
+ attr_reader background: color_value?
28
+ attr_reader bold: boolean_value?
29
+ attr_reader faint: boolean_value?
30
+ attr_reader italic: boolean_value?
31
+ attr_reader underline: underline_value?
32
+ attr_reader overline: boolean_value?
33
+ attr_reader blink: boolean_value?
34
+ attr_reader inverse: boolean_value?
35
+ attr_reader conceal: boolean_value?
36
+
37
+ def initialize: (
38
+ ?foreground: color_value?,
39
+ ?background: color_value?,
40
+ ?bold: boolean_value?,
41
+ ?faint: boolean_value?,
42
+ ?italic: boolean_value?,
43
+ ?underline: underline_value?,
44
+ ?overline: boolean_value?,
45
+ ?blink: boolean_value?,
46
+ ?inverse: boolean_value?,
47
+ ?conceal: boolean_value?
48
+ ) -> void
49
+
50
+ def call: (String text) -> String
51
+
52
+ alias [] call
53
+
54
+ def >>: (Style other) -> Style
55
+
56
+ private
57
+
58
+ def compose_attribute: ((color_value | underline_value | boolean_value)?, (color_value | underline_value | boolean_value)?) -> (color_value | underline_value | boolean_value)?
59
+
60
+ end
61
+ end
metadata ADDED
@@ -0,0 +1,131 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tint_me
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - OZAWA Sakuro
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: dry-schema
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.13'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.13'
26
+ - !ruby/object:Gem::Dependency
27
+ name: dry-types
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.7'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.7'
40
+ - !ruby/object:Gem::Dependency
41
+ name: zeitwerk
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.6'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.6'
54
+ description: |
55
+ A Ruby library for terminal text styling with ANSI colors and effects.
56
+ Provides an elegant, functional API with immutable style objects that can be
57
+ composed using the >> operator. Supports standard colors, hex values,
58
+ and comprehensive text effects including bold, faint, italic, underline,
59
+ overline, blink, inverse, and concealed text. Features type-safe argument
60
+ validation using dry-schema and dry-types.
61
+ email:
62
+ - 10973+sakuro@users.noreply.github.com
63
+ executables: []
64
+ extensions: []
65
+ extra_rdoc_files: []
66
+ files:
67
+ - ".rubocop_todo.yml"
68
+ - ".serena/project.yml"
69
+ - ".simplecov"
70
+ - ".yardopts"
71
+ - AGENTS.md
72
+ - CHANGELOG.md
73
+ - CLAUDE.md
74
+ - LICENSE.txt
75
+ - README.md
76
+ - RELEASING.md
77
+ - Rakefile
78
+ - benchmark/2025-09-08-style-caching-optimization/01_baseline_results.txt
79
+ - benchmark/2025-09-08-style-caching-optimization/02_with_full_caching_results.txt
80
+ - benchmark/2025-09-08-style-caching-optimization/03_prefix_only_caching_results.txt
81
+ - benchmark/2025-09-08-style-caching-optimization/04_baseline_vs_optimized_analysis.txt
82
+ - benchmark/2025-09-08-style-caching-optimization/05_caching_approaches_comparison.txt
83
+ - benchmark/2025-09-08-style-caching-optimization/06_append_operator_results.txt
84
+ - benchmark/2025-09-08-style-caching-optimization/07_string_concatenation_comparison.txt
85
+ - benchmark/2025-09-08-style-caching-optimization/08_with_freeze_optimization_results.txt
86
+ - benchmark/2025-09-08-style-caching-optimization/09_freeze_optimization_analysis.txt
87
+ - benchmark/2025-09-08-style-caching-optimization/10_constant_access_results.txt
88
+ - benchmark/2025-09-08-style-caching-optimization/11_constant_vs_cache_analysis.txt
89
+ - benchmark/2025-09-08-style-caching-optimization/12_empty_prefix_analysis.txt
90
+ - benchmark/2025-09-08-style-caching-optimization/13_nil_check_optimization_results.txt
91
+ - benchmark/2025-09-08-style-caching-optimization/14_nil_vs_empty_check_analysis.txt
92
+ - benchmark/2025-09-08-style-caching-optimization/README.md
93
+ - benchmark/2025-09-08-style-caching-optimization/benchmark_script.rb
94
+ - docs/agents/git-pr.md
95
+ - docs/agents/languages.md
96
+ - docs/agents/rubocop.md
97
+ - lib/tint_me.rb
98
+ - lib/tint_me/error.rb
99
+ - lib/tint_me/sgr_builder.rb
100
+ - lib/tint_me/style.rb
101
+ - lib/tint_me/style/schema.rb
102
+ - lib/tint_me/style/types.rb
103
+ - lib/tint_me/version.rb
104
+ - mise.toml
105
+ - sig/tint_me.rbs
106
+ homepage: https://github.com/sakuro/tint_me
107
+ licenses:
108
+ - MIT
109
+ metadata:
110
+ homepage_uri: https://github.com/sakuro/tint_me
111
+ source_code_uri: https://github.com/sakuro/tint_me.git
112
+ changelog_uri: https://github.com/sakuro/tint_me/blob/main/CHANGELOG.md
113
+ rubygems_mfa_required: 'true'
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: 3.2.9
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubygems_version: 3.6.9
129
+ specification_version: 4
130
+ summary: Functional terminal text styling with composable ANSI colors and effects
131
+ test_files: []