customization 1.0.0 → 1.0.4
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.
- checksums.yaml +4 -4
- data/lib/customization.rb +23 -0
- data/lib/errors.rb +0 -6
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc4e9ff270ea764dc80f0e1aee1d6728b041d20c759e08017ed68a1f0783d7f
|
4
|
+
data.tar.gz: 02ab73dc46fdb3a0962d69af665810f1389feb0d1ff28aa818fe1068d0ff3753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4343a4cc9a30d1175b250c2ec981a6d6a7a42a24913af8c15941d27545a8024dba19a0428fdc5ab971b7ce837d18e434513c489688d7a348dcd9dc7426698bcd
|
7
|
+
data.tar.gz: 437ace4e60afc241bc748dd4553a199a81bfba47c6ee72ac39a26d32021866020787ce84788c866d35196e851e74e6161c4b04f387396cf206123087f04692eb
|
data/lib/customization.rb
CHANGED
@@ -254,6 +254,29 @@ module Customization
|
|
254
254
|
"#{TEXT_EFFECTS[:blink]}#{text}#{FORMATS[:reset]}"
|
255
255
|
end
|
256
256
|
|
257
|
+
def self.scroll_text(text, speed = 1)
|
258
|
+
# Simulate scrolling text with the specified speed
|
259
|
+
text_length = visible_length(text)
|
260
|
+
text_with_padding = " " * text_length + text + " " * text_length
|
261
|
+
delay = 1.0 / speed
|
262
|
+
|
263
|
+
text_with_padding.chars.each_with_index do |char, index|
|
264
|
+
print "\r#{text_with_padding[index, text_length]}"
|
265
|
+
sleep(delay)
|
266
|
+
end
|
267
|
+
print "\n"
|
268
|
+
end
|
269
|
+
|
270
|
+
def self.typewriter_text(text, speed = 0.1)
|
271
|
+
# Simulate a typewriter effect with the specified speed
|
272
|
+
text.each_char do |char|
|
273
|
+
print char
|
274
|
+
sleep(speed)
|
275
|
+
end
|
276
|
+
print "\n"
|
277
|
+
end
|
278
|
+
|
279
|
+
|
257
280
|
def self.color_text(text, color, custom_code = nil)
|
258
281
|
if COLORS.key?(color)
|
259
282
|
"#{COLORS[color]}#{text}#{FORMATS[:reset]}"
|
data/lib/errors.rb
CHANGED
@@ -13,12 +13,6 @@ module Customization
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
class InvalidFontSizeError < StandardError
|
17
|
-
def initialize(size)
|
18
|
-
super("Invalid font size: #{size}")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
16
|
class InvalidBorderError < StandardError
|
23
17
|
def initialize(border)
|
24
18
|
super("Invalid text border style: #{border}")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: customization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ThatAlecs
|
@@ -10,8 +10,11 @@ bindir: bin
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2023-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Customization is a
|
14
|
-
|
13
|
+
description: The Customization module is a versatile Ruby library designed to enhance
|
14
|
+
your text formatting capabilities in the terminal. This module empowers you to add
|
15
|
+
style, color, and effects to text, making it an excellent tool for creating visually
|
16
|
+
appealing command-line applications, generating stylish reports, or simply adding
|
17
|
+
a touch of flair to your terminal outputs.
|
15
18
|
email:
|
16
19
|
executables: []
|
17
20
|
extensions: []
|
@@ -19,11 +22,12 @@ extra_rdoc_files: []
|
|
19
22
|
files:
|
20
23
|
- lib/customization.rb
|
21
24
|
- lib/errors.rb
|
22
|
-
homepage: https://github.com/thatalecs/
|
25
|
+
homepage: https://github.com/thatalecs/customization
|
23
26
|
licenses:
|
24
27
|
- MIT
|
25
28
|
metadata:
|
26
|
-
|
29
|
+
documentation_uri: https://github.com/thatalecs/customization/wiki
|
30
|
+
source_code_uri: https://github.com/thatalecs/customization
|
27
31
|
post_install_message:
|
28
32
|
rdoc_options: []
|
29
33
|
require_paths:
|
@@ -32,7 +36,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
32
36
|
requirements:
|
33
37
|
- - ">="
|
34
38
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
39
|
+
version: 2.5.0
|
36
40
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
37
41
|
requirements:
|
38
42
|
- - ">="
|