render-text-helper 0.3.0 → 0.3.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +9 -1
- data/Gemfile +2 -2
- data/Gemfile.lock +36 -32
- data/README.md +19 -0
- data/lib/render/text/helper/string.rb +15 -0
- data/lib/render/text/helper/version.rb +1 -1
- data/render-text-helper.gemspec +4 -3
- metadata +7 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a16d3ef03a33b4763eeb84d7e72162eef89b34c3d138792b2f21af0b503f211
|
4
|
+
data.tar.gz: 1a5f5f19b1261d873a703d45feb3704509754e64aa92ec6e922bb12471d823f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17eef48dab9ff66109a80e8c985d259632dab92410a7a74e23790ddba9283b721d7a17fb01a144f829652a8e5aaed1b7ea5f9506f1fe93da1874e8d4fe77a6b1
|
7
|
+
data.tar.gz: e45e71e62432bf2a5e892e78ed466ca510e5e7610ce963b6b079b17d56df8879ad95f6d7b0cc669a8dd8c47031c4ea292b0278ee6548e6c0314ac2414f5d23a7
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,48 +1,52 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
render-text-helper (0.3.
|
4
|
+
render-text-helper (0.3.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
9
|
ast (2.4.2)
|
10
|
-
diff-lcs (1.5.
|
11
|
-
json (2.
|
12
|
-
|
13
|
-
|
10
|
+
diff-lcs (1.5.1)
|
11
|
+
json (2.9.1)
|
12
|
+
language_server-protocol (3.17.0.3)
|
13
|
+
parallel (1.26.3)
|
14
|
+
parser (3.3.6.0)
|
14
15
|
ast (~> 2.4.1)
|
16
|
+
racc
|
17
|
+
racc (1.8.1)
|
15
18
|
rainbow (3.1.1)
|
16
|
-
rake (13.
|
17
|
-
regexp_parser (2.
|
18
|
-
|
19
|
-
|
20
|
-
rspec-
|
21
|
-
rspec-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
rspec-expectations (3.11.0)
|
19
|
+
rake (13.2.1)
|
20
|
+
regexp_parser (2.10.0)
|
21
|
+
rspec (3.13.0)
|
22
|
+
rspec-core (~> 3.13.0)
|
23
|
+
rspec-expectations (~> 3.13.0)
|
24
|
+
rspec-mocks (~> 3.13.0)
|
25
|
+
rspec-core (3.13.2)
|
26
|
+
rspec-support (~> 3.13.0)
|
27
|
+
rspec-expectations (3.13.3)
|
26
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
29
|
+
rspec-support (~> 3.13.0)
|
30
|
+
rspec-mocks (3.13.2)
|
29
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
32
|
-
rubocop (1.
|
32
|
+
rspec-support (~> 3.13.0)
|
33
|
+
rspec-support (3.13.2)
|
34
|
+
rubocop (1.69.2)
|
33
35
|
json (~> 2.3)
|
36
|
+
language_server-protocol (>= 3.17.0)
|
34
37
|
parallel (~> 1.10)
|
35
|
-
parser (>= 3.
|
38
|
+
parser (>= 3.3.0.2)
|
36
39
|
rainbow (>= 2.2.2, < 4.0)
|
37
|
-
regexp_parser (>=
|
38
|
-
|
39
|
-
rubocop-ast (>= 1.20.1, < 2.0)
|
40
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
41
|
+
rubocop-ast (>= 1.36.2, < 2.0)
|
40
42
|
ruby-progressbar (~> 1.7)
|
41
|
-
unicode-display_width (>=
|
42
|
-
rubocop-ast (1.
|
43
|
-
parser (>= 3.
|
44
|
-
ruby-progressbar (1.
|
45
|
-
unicode-display_width (
|
43
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
44
|
+
rubocop-ast (1.37.0)
|
45
|
+
parser (>= 3.3.1.0)
|
46
|
+
ruby-progressbar (1.13.0)
|
47
|
+
unicode-display_width (3.1.2)
|
48
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
49
|
+
unicode-emoji (4.0.4)
|
46
50
|
|
47
51
|
PLATFORMS
|
48
52
|
x86_64-linux
|
@@ -50,8 +54,8 @@ PLATFORMS
|
|
50
54
|
DEPENDENCIES
|
51
55
|
rake (~> 13.0)
|
52
56
|
render-text-helper!
|
53
|
-
rspec (~> 3.
|
54
|
-
rubocop (~> 1.
|
57
|
+
rspec (~> 3.11)
|
58
|
+
rubocop (~> 1.5)
|
55
59
|
|
56
60
|
BUNDLED WITH
|
57
|
-
2.
|
61
|
+
2.6.2
|
data/README.md
CHANGED
@@ -39,6 +39,25 @@ It has three parameters.
|
|
39
39
|
'elep**'
|
40
40
|
```
|
41
41
|
|
42
|
+
### To Smart Array
|
43
|
+
|
44
|
+
Take a string and splits it to an array by ",", "|", space, or by a passed parameter.
|
45
|
+
It also strips whitespace.
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
'cat, dog, matt'.to_smart_array
|
49
|
+
['cat', 'dog', 'matt']
|
50
|
+
|
51
|
+
' cat , dog, matt,pat '.to_smart_array
|
52
|
+
['cat', 'dog', 'matt', 'pat']
|
53
|
+
|
54
|
+
' cat dog matt pat '.to_smart_array
|
55
|
+
['cat', 'dog', 'matt', 'pat']
|
56
|
+
|
57
|
+
' cat # dog# matt#pat '.to_smart_array('#')
|
58
|
+
['cat', 'dog', 'matt', 'pat']
|
59
|
+
```
|
60
|
+
|
42
61
|
### to yes no
|
43
62
|
|
44
63
|
This function returns a string from a boolean to yes or no.
|
@@ -8,4 +8,19 @@ class String
|
|
8
8
|
|
9
9
|
[self[0...limit], (more_indicator * indicator_length)].join
|
10
10
|
end
|
11
|
+
|
12
|
+
# outputs an array
|
13
|
+
def to_smart_array(separator = nil)
|
14
|
+
return [] if nil?
|
15
|
+
|
16
|
+
return split(separator).map(&:strip) unless separator.nil?
|
17
|
+
return split(',').map(&:strip) if include?(',')
|
18
|
+
|
19
|
+
split.map(&:strip)
|
20
|
+
end
|
21
|
+
|
22
|
+
# outputs string where it replaces \n or \r with actual return
|
23
|
+
def escaped_newline_to_newline
|
24
|
+
self.gsub('\n', "\n").gsub('\r', "\n")
|
25
|
+
end
|
11
26
|
end
|
data/render-text-helper.gemspec
CHANGED
@@ -8,11 +8,11 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Saimon Lovell']
|
9
9
|
spec.email = ['staysynchronize@gmail.com']
|
10
10
|
|
11
|
-
spec.summary = 'Does some string
|
12
|
-
spec.description = '
|
11
|
+
spec.summary = 'Does some string manipulation'
|
12
|
+
spec.description = 'Add some more functionality to string and booleans'
|
13
13
|
spec.homepage = 'https://github.com/SaimonL/render-text-helper'
|
14
14
|
spec.license = 'MIT'
|
15
|
-
spec.required_ruby_version = '>=
|
15
|
+
spec.required_ruby_version = '>= 3.1'
|
16
16
|
|
17
17
|
spec.metadata['allowed_push_host'] = 'https://rubygems.org'
|
18
18
|
|
@@ -28,4 +28,5 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.bindir = 'exe'
|
29
29
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
30
|
spec.require_paths = ['lib']
|
31
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
31
32
|
end
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render-text-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saimon Lovell
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2024-12-26 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
|
-
description:
|
12
|
+
description: Add some more functionality to string and booleans
|
14
13
|
email:
|
15
14
|
- staysynchronize@gmail.com
|
16
15
|
executables: []
|
@@ -41,7 +40,7 @@ metadata:
|
|
41
40
|
homepage_uri: https://github.com/SaimonL/render-text-helper
|
42
41
|
source_code_uri: https://github.com/SaimonL/render-text-helper
|
43
42
|
changelog_uri: https://github.com/SaimonL/render-text-helper/blob/master/CHANGELOG.md
|
44
|
-
|
43
|
+
rubygems_mfa_required: 'true'
|
45
44
|
rdoc_options: []
|
46
45
|
require_paths:
|
47
46
|
- lib
|
@@ -49,15 +48,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
48
|
requirements:
|
50
49
|
- - ">="
|
51
50
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
51
|
+
version: '3.1'
|
53
52
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
53
|
requirements:
|
55
54
|
- - ">="
|
56
55
|
- !ruby/object:Gem::Version
|
57
56
|
version: '0'
|
58
57
|
requirements: []
|
59
|
-
rubygems_version: 3.
|
60
|
-
signing_key:
|
58
|
+
rubygems_version: 3.6.2
|
61
59
|
specification_version: 4
|
62
|
-
summary: Does some string
|
60
|
+
summary: Does some string manipulation
|
63
61
|
test_files: []
|