render-text-helper 0.3.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e58ee7a37f97f1926b022eeacbdc250da3edd0d06f168089319a1340137eb7dc
4
- data.tar.gz: ef6be5462f64aa6a9d2191245b5bba9c8028ba4364092499202ed5aeaf211a23
3
+ metadata.gz: 976a5049554652256d97459fad88c7aa9df80eb039ce8d1afe886b08c54282f2
4
+ data.tar.gz: 969f89a11f8a039984cc99ee6838454b3af07dd12fbe4335269c9a618dadd706
5
5
  SHA512:
6
- metadata.gz: 6278202b3b758d3aa1229a748e0eed12c45a127a3dd4ba9cad1a7793c04348f5d35cb5f484d4281910635716089c3f7a1fbe2a5387c26b9b3859895aa6e3edfb
7
- data.tar.gz: 2e81e29d670ff5e158e35ca329989eef65bd3f26077cf3f84b863f2027b9154312cf8fed5c7ae35347c9aa338bfecec44ee2520d559fc7b42d2de8f8f1c10387
6
+ metadata.gz: 047de4cedc9dac79094b1eb50739e2081a9d6f61df68bbe142138c39516efce06bbf487e1d8ad8b4e4dce3787b3c4415e75b92c69375be56fc16670da49ba844
7
+ data.tar.gz: a2bc1a496320d5b525d414aae15bcfa7cb4ab09c574babd5c87db6b340594700880cc3e7fdf61e59e5d3e4e32ebdfe3f674bd2d97c4c4ccbb4d07a911fa240dc
data/.rubocop.yml CHANGED
@@ -15,6 +15,8 @@ Layout/LineLength:
15
15
 
16
16
  Metrics/BlockLength:
17
17
  Max: 50
18
+ Exclude:
19
+ - spec/render/text/helper/*.rb
18
20
 
19
21
  Layout/CaseIndentation:
20
22
  EnforcedStyle: end
data/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
- ## Changelog
1
+ # Changelog
2
+
3
+ ## [0.4.0] - 2025-17-02
4
+
5
+ - Added to_titleize
6
+
7
+ ## [0.3.2] - 2024-12-26
8
+
9
+ - Replaces escaped return with actual return
2
10
 
3
11
  ## [0.3.1] - 2023-11-3
4
12
 
data/Gemfile.lock CHANGED
@@ -1,52 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- render-text-helper (0.3.1)
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.5.0)
11
- json (2.6.3)
12
- language_server-protocol (3.17.0.3)
13
- parallel (1.23.0)
14
- parser (3.2.2.4)
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)
14
+ parallel (1.26.3)
15
+ parser (3.3.7.1)
15
16
  ast (~> 2.4.1)
16
17
  racc
17
- racc (1.7.2)
18
+ racc (1.8.1)
18
19
  rainbow (3.1.1)
19
- rake (13.1.0)
20
- regexp_parser (2.8.2)
21
- rexml (3.2.6)
22
- rspec (3.12.0)
23
- rspec-core (~> 3.12.0)
24
- rspec-expectations (~> 3.12.0)
25
- rspec-mocks (~> 3.12.0)
26
- rspec-core (3.12.2)
27
- rspec-support (~> 3.12.0)
28
- rspec-expectations (3.12.3)
20
+ rake (13.2.1)
21
+ regexp_parser (2.10.0)
22
+ rspec (3.13.0)
23
+ rspec-core (~> 3.13.0)
24
+ rspec-expectations (~> 3.13.0)
25
+ rspec-mocks (~> 3.13.0)
26
+ rspec-core (3.13.3)
27
+ rspec-support (~> 3.13.0)
28
+ rspec-expectations (3.13.3)
29
29
  diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.12.0)
31
- rspec-mocks (3.12.6)
30
+ rspec-support (~> 3.13.0)
31
+ rspec-mocks (3.13.2)
32
32
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.12.0)
34
- rspec-support (3.12.1)
35
- rubocop (1.57.2)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-support (3.13.2)
35
+ rubocop (1.72.1)
36
36
  json (~> 2.3)
37
- language_server-protocol (>= 3.17.0)
37
+ language_server-protocol (~> 3.17.0.2)
38
+ lint_roller (~> 1.1.0)
38
39
  parallel (~> 1.10)
39
- parser (>= 3.2.2.4)
40
+ parser (>= 3.3.0.2)
40
41
  rainbow (>= 2.2.2, < 4.0)
41
- regexp_parser (>= 1.8, < 3.0)
42
- rexml (>= 3.2.5, < 4.0)
43
- rubocop-ast (>= 1.28.1, < 2.0)
42
+ regexp_parser (>= 2.9.3, < 3.0)
43
+ rubocop-ast (>= 1.38.0, < 2.0)
44
44
  ruby-progressbar (~> 1.7)
45
- unicode-display_width (>= 2.4.0, < 3.0)
46
- rubocop-ast (1.30.0)
47
- parser (>= 3.2.1.0)
45
+ unicode-display_width (>= 2.4.0, < 4.0)
46
+ rubocop-ast (1.38.0)
47
+ parser (>= 3.3.1.0)
48
48
  ruby-progressbar (1.13.0)
49
- unicode-display_width (2.5.0)
49
+ unicode-display_width (3.1.4)
50
+ unicode-emoji (~> 4.0, >= 4.0.4)
51
+ unicode-emoji (4.0.4)
50
52
 
51
53
  PLATFORMS
52
54
  x86_64-linux
@@ -58,4 +60,4 @@ DEPENDENCIES
58
60
  rubocop (~> 1.5)
59
61
 
60
62
  BUNDLED WITH
61
- 2.4.17
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
@@ -18,4 +23,11 @@ class String
18
23
 
19
24
  split.map(&:strip)
20
25
  end
26
+
27
+ def to_titleize
28
+ return '' if self == ''
29
+ return upcase if length == 1
30
+
31
+ gsub('_', ' ').strip.split.map(&:capitalize).join(' ')
32
+ end
21
33
  end
@@ -3,7 +3,7 @@
3
3
  module Render
4
4
  module Text
5
5
  module Helper
6
- VERSION = '0.3.1'
6
+ VERSION = '0.4.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render-text-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saimon Lovell
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
10
+ date: 2025-02-17 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: Add some more functionality to string and booleans
14
13
  email:
@@ -29,7 +28,6 @@ files:
29
28
  - lib/render/text/helper/boolean.rb
30
29
  - lib/render/text/helper/string.rb
31
30
  - lib/render/text/helper/version.rb
32
- - render-text-helper.gemspec
33
31
  - sig/render/text/helper.rbs
34
32
  - sig/render/text/helper/boolean.rbs
35
33
  - sig/render/text/helper/string.rbs
@@ -42,7 +40,6 @@ metadata:
42
40
  source_code_uri: https://github.com/SaimonL/render-text-helper
43
41
  changelog_uri: https://github.com/SaimonL/render-text-helper/blob/master/CHANGELOG.md
44
42
  rubygems_mfa_required: 'true'
45
- post_install_message:
46
43
  rdoc_options: []
47
44
  require_paths:
48
45
  - lib
@@ -57,8 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
54
  - !ruby/object:Gem::Version
58
55
  version: '0'
59
56
  requirements: []
60
- rubygems_version: 3.4.21
61
- signing_key:
57
+ rubygems_version: 3.6.3
62
58
  specification_version: 4
63
59
  summary: Does some string manipulation
64
60
  test_files: []
@@ -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