rb_monkey 0.1.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 (4) hide show
  1. checksums.yaml +7 -0
  2. data/src/rb_monkey.rb +1 -0
  3. data/src/string.rb +55 -0
  4. metadata +43 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 46be32d69852e25be6914220ea2759591d8f8fb48a603c59fe548d53d7f0d8fe
4
+ data.tar.gz: c8201322ff197959c67e05bb160a087c70436f2334e7506ad7affdf799827cc5
5
+ SHA512:
6
+ metadata.gz: abc1d37a3af7a2af0f22ffdbfbd7e3cc4afa8b7b8cf7c1a91fb0f68eb4b68702ea1ce988d0dc75d8ed7bb4d81d81d8fae56c47fbbab23f38455490ee69b4c84f
7
+ data.tar.gz: e731ded0500de458e2130df6c1cd92482cd76926c732501a499c6d74d5564b9b4ee4f62967f93583555169db6f684c835f2c840b5e20e2427a55f5fc473252c8
data/src/rb_monkey.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative "./string"
data/src/string.rb ADDED
@@ -0,0 +1,55 @@
1
+ # https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797
2
+ class String
3
+ @@styles = {
4
+ :bold => "1",
5
+ :dim => "2",
6
+ :italic => "3",
7
+ :underline => "4",
8
+ :inverse => "7",
9
+ :strikethrough => "9",
10
+ :fg_black => "30",
11
+ :fg_red => "31",
12
+ :fg_green => "32",
13
+ :fg_yellow => "33",
14
+ :fg_blue => "34",
15
+ :fg_magenta => "35",
16
+ :fg_cyan => "36",
17
+ :fg_white => "37",
18
+ :fg_bright_black => "30;1",
19
+ :fg_bright_red => "31;1",
20
+ :fg_bright_green => "32;1",
21
+ :fg_bright_yellow => "33;1",
22
+ :fg_bright_blue => "34;1",
23
+ :fg_bright_magenta => "35;1",
24
+ :fg_bright_cyan => "36;1",
25
+ :fg_bright_white => "37;1",
26
+ }
27
+
28
+ # To be able to handle more styles (with method chaining) we should refactor this.
29
+ def stylize(style)
30
+ "\033[#{@@styles[style.to_sym]}m#{self}\033[0m"
31
+ end
32
+
33
+ def bold; stylize(:bold); end
34
+ def dim; stylize(:dim); end
35
+ def italic; stylize(:italic); end
36
+ def underline; stylize(:underline); end
37
+ def inverse; stylize(:inverse); end
38
+ def strikethrough; stylize(:strikethrough); end
39
+ def black; stylize(:fg_black); end
40
+ def red; stylize(:fg_red); end
41
+ def green; stylize(:fg_green); end
42
+ def yellow; stylize(:fg_yellow); end
43
+ def blue; stylize(:fg_blue); end
44
+ def magenta; stylize(:fg_magenta); end
45
+ def cyan; stylize(:fg_cyan); end
46
+ def white; stylize(:fg_white); end
47
+ def bright_black; stylize(:fg_bright_black); end
48
+ def bright_red; stylize(:fg_bright_red); end
49
+ def bright_green; stylize(:fg_bright_green); end
50
+ def bright_yellow; stylize(:fg_bright_yellow); end
51
+ def bright_blue; stylize(:fg_bright_blue); end
52
+ def bright_magenta; stylize(:fg_bright_magenta); end
53
+ def bright_cyan; stylize(:fg_bright_cyan); end
54
+ def bright_white; stylize(:fg_bright_white); end
55
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rb_monkey
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Aurélien Delogu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-01-06 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: aurelien.delogu@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - src/rb_monkey.rb
20
+ - src/string.rb
21
+ homepage:
22
+ licenses: []
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - src
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubygems_version: 3.0.3.1
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Monkey patches
43
+ test_files: []