render-text-helper 0.3.2 → 0.4.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +14 -12
- data/README.md +18 -0
- data/lib/render/text/helper/string.rb +10 -3
- data/lib/render/text/helper/version.rb +1 -1
- metadata +3 -4
- data/render-text-helper.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 976a5049554652256d97459fad88c7aa9df80eb039ce8d1afe886b08c54282f2
|
4
|
+
data.tar.gz: 969f89a11f8a039984cc99ee6838454b3af07dd12fbe4335269c9a618dadd706
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 047de4cedc9dac79094b1eb50739e2081a9d6f61df68bbe142138c39516efce06bbf487e1d8ad8b4e4dce3787b3c4415e75b92c69375be56fc16670da49ba844
|
7
|
+
data.tar.gz: a2bc1a496320d5b525d414aae15bcfa7cb4ab09c574babd5c87db6b340594700880cc3e7fdf61e59e5d3e4e32ebdfe3f674bd2d97c4c4ccbb4d07a911fa240dc
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
render-text-helper (0.
|
4
|
+
render-text-helper (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.2)
|
10
|
-
diff-lcs (1.
|
11
|
-
json (2.
|
12
|
-
language_server-protocol (3.17.0.
|
10
|
+
diff-lcs (1.6.0)
|
11
|
+
json (2.10.1)
|
12
|
+
language_server-protocol (3.17.0.4)
|
13
|
+
lint_roller (1.1.0)
|
13
14
|
parallel (1.26.3)
|
14
|
-
parser (3.3.
|
15
|
+
parser (3.3.7.1)
|
15
16
|
ast (~> 2.4.1)
|
16
17
|
racc
|
17
18
|
racc (1.8.1)
|
@@ -22,7 +23,7 @@ GEM
|
|
22
23
|
rspec-core (~> 3.13.0)
|
23
24
|
rspec-expectations (~> 3.13.0)
|
24
25
|
rspec-mocks (~> 3.13.0)
|
25
|
-
rspec-core (3.13.
|
26
|
+
rspec-core (3.13.3)
|
26
27
|
rspec-support (~> 3.13.0)
|
27
28
|
rspec-expectations (3.13.3)
|
28
29
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -31,20 +32,21 @@ GEM
|
|
31
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
33
|
rspec-support (~> 3.13.0)
|
33
34
|
rspec-support (3.13.2)
|
34
|
-
rubocop (1.
|
35
|
+
rubocop (1.72.1)
|
35
36
|
json (~> 2.3)
|
36
|
-
language_server-protocol (
|
37
|
+
language_server-protocol (~> 3.17.0.2)
|
38
|
+
lint_roller (~> 1.1.0)
|
37
39
|
parallel (~> 1.10)
|
38
40
|
parser (>= 3.3.0.2)
|
39
41
|
rainbow (>= 2.2.2, < 4.0)
|
40
42
|
regexp_parser (>= 2.9.3, < 3.0)
|
41
|
-
rubocop-ast (>= 1.
|
43
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
42
44
|
ruby-progressbar (~> 1.7)
|
43
45
|
unicode-display_width (>= 2.4.0, < 4.0)
|
44
|
-
rubocop-ast (1.
|
46
|
+
rubocop-ast (1.38.0)
|
45
47
|
parser (>= 3.3.1.0)
|
46
48
|
ruby-progressbar (1.13.0)
|
47
|
-
unicode-display_width (3.1.
|
49
|
+
unicode-display_width (3.1.4)
|
48
50
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
49
51
|
unicode-emoji (4.0.4)
|
50
52
|
|
@@ -58,4 +60,4 @@ DEPENDENCIES
|
|
58
60
|
rubocop (~> 1.5)
|
59
61
|
|
60
62
|
BUNDLED WITH
|
61
|
-
2.6.
|
63
|
+
2.6.3
|
data/README.md
CHANGED
@@ -58,6 +58,24 @@ It also strips whitespace.
|
|
58
58
|
['cat', 'dog', 'matt', 'pat']
|
59
59
|
```
|
60
60
|
|
61
|
+
### To Titleize
|
62
|
+
|
63
|
+
Titleize for none rails project. It also removes unnecessary white spaces and converts "_" to spaces.
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
'hello world!'.to_titleize
|
67
|
+
"Hello World!"
|
68
|
+
|
69
|
+
'HELLO WORLD!'.to_titleize
|
70
|
+
"Hello World!"
|
71
|
+
|
72
|
+
'hello_world!'.to_titleize
|
73
|
+
"Hello World!"
|
74
|
+
|
75
|
+
' hello world! '.to_titleize
|
76
|
+
"Hello World!"
|
77
|
+
```
|
78
|
+
|
61
79
|
### to yes no
|
62
80
|
|
63
81
|
This function returns a string from a boolean to yes or no.
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
# Adds function to existing String class
|
4
4
|
class String
|
5
|
+
# outputs string where it replaces \n or \r with actual return
|
6
|
+
def escaped_newline_to_newline
|
7
|
+
gsub('\n', "\n").gsub('\r', "\n")
|
8
|
+
end
|
9
|
+
|
5
10
|
# output the string giving the limit. It does not touch the string
|
6
11
|
def limit_print(limit: 32, more_indicator: '.', indicator_length: 3)
|
7
12
|
return self if size < limit
|
@@ -19,8 +24,10 @@ class String
|
|
19
24
|
split.map(&:strip)
|
20
25
|
end
|
21
26
|
|
22
|
-
|
23
|
-
|
24
|
-
|
27
|
+
def to_titleize
|
28
|
+
return '' if self == ''
|
29
|
+
return upcase if length == 1
|
30
|
+
|
31
|
+
gsub('_', ' ').strip.split.map(&:capitalize).join(' ')
|
25
32
|
end
|
26
33
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render-text-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saimon Lovell
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 2025-02-17 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
description: Add some more functionality to string and booleans
|
13
13
|
email:
|
@@ -28,7 +28,6 @@ files:
|
|
28
28
|
- lib/render/text/helper/boolean.rb
|
29
29
|
- lib/render/text/helper/string.rb
|
30
30
|
- lib/render/text/helper/version.rb
|
31
|
-
- render-text-helper.gemspec
|
32
31
|
- sig/render/text/helper.rbs
|
33
32
|
- sig/render/text/helper/boolean.rbs
|
34
33
|
- sig/render/text/helper/string.rbs
|
@@ -55,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
54
|
- !ruby/object:Gem::Version
|
56
55
|
version: '0'
|
57
56
|
requirements: []
|
58
|
-
rubygems_version: 3.6.
|
57
|
+
rubygems_version: 3.6.3
|
59
58
|
specification_version: 4
|
60
59
|
summary: Does some string manipulation
|
61
60
|
test_files: []
|
data/render-text-helper.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'lib/render/text/helper/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'render-text-helper'
|
7
|
-
spec.version = Render::Text::Helper::VERSION
|
8
|
-
spec.authors = ['Saimon Lovell']
|
9
|
-
spec.email = ['staysynchronize@gmail.com']
|
10
|
-
|
11
|
-
spec.summary = 'Does some string manipulation'
|
12
|
-
spec.description = 'Add some more functionality to string and booleans'
|
13
|
-
spec.homepage = 'https://github.com/SaimonL/render-text-helper'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = '>= 3.1'
|
16
|
-
|
17
|
-
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
|
-
|
19
|
-
spec.metadata['homepage_uri'] = spec.homepage
|
20
|
-
spec.metadata['source_code_uri'] = 'https://github.com/SaimonL/render-text-helper'
|
21
|
-
spec.metadata['changelog_uri'] = 'https://github.com/SaimonL/render-text-helper/blob/master/CHANGELOG.md'
|
22
|
-
|
23
|
-
spec.files = Dir.chdir(__dir__) do
|
24
|
-
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
-
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
26
|
-
end
|
27
|
-
end
|
28
|
-
spec.bindir = 'exe'
|
29
|
-
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
-
spec.require_paths = ['lib']
|
31
|
-
spec.metadata['rubygems_mfa_required'] = 'true'
|
32
|
-
end
|