cutword 1.0.0 → 2.0.0.pre.alpha2

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: b3e7954cdb66ba85a0dbe32671efaad26a25626b13b554edfba3beeb9f6e2314
4
- data.tar.gz: 3828a46fe84cdd75598207c44871ddaafd0418057e7da66bfeb83abe6fc8bc7b
3
+ metadata.gz: 3f7e9a8fcd185e1ec47ec3a222413f9b828537791e1f026ef5f7442d236909c8
4
+ data.tar.gz: 59482810eeb3180668222ae9b51f1a74ed12982ef3c9cad8c2ffcc261629852d
5
5
  SHA512:
6
- metadata.gz: d7cffe13270a08aef3b46e0f126826369b96e5dc39bbacdc9bc0d39ac107c18e5f255f1616d0d832f800e3dd116db10d581be92a61a1e466d776acb3b99ccf89
7
- data.tar.gz: 5e31cf2d18683651727eba5c55bddca5eca7eeb92ad9a8016f841274d7c6533dfbb63e339e2d0a46ae8646d1622222578e927d3080df8be706d550931f3b08f2
6
+ metadata.gz: 4a98830366a52b60c84a4bd1726934c86c14a05411b0a5279a88fca62f0996d0e0dac8db50e8ba4c84d521eb6eb20516d0f43966e580ed4bfb9756db38d56b19
7
+ data.tar.gz: a3351559f6c7d253ed6a13d4689edab9809f9e2049dd850e0e3812dbe157e7a5075f3ee73f6f0adfb5628f330987ce6425621e80b3edc8b88561056383be307c
@@ -1,3 +1,3 @@
1
1
  module Cutword
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '2.0.0-alpha2'
3
3
  end
data/lib/cutword.rb CHANGED
@@ -1,16 +1,16 @@
1
- require 'cutword/version'
2
- require 'cutword/get_string'
1
+ # lib/cutword.rb
2
+
3
+
3
4
 
4
5
  module Cutword
5
6
  class << self
6
- def get(text, max_length)
7
+ def get(max_length, text)
7
8
  if text.length > max_length
8
- truncated_text = text[0...max_length - 3].strip
9
- truncated_text + '...'
9
+ truncated_text = text[0...max_length].strip
10
+ truncated_text + (truncated_text.length < text.length ? '...' : '')
10
11
  else
11
12
  text
12
13
  end
13
14
  end
14
15
  end
15
- end
16
-
16
+ end
metadata CHANGED
@@ -1,24 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutword
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0.pre.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Demjhon Silver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-13 00:00:00.000000000 Z
11
+ date: 2024-04-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: This gem provides a string truncation/cutting words method for Ruby on
14
- Rails applications.
13
+ description: This gem provides string truncation and word cutting functionality for
14
+ both Rails and Hanami.
15
15
  email: none
16
16
  executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
20
  - lib/cutword.rb
21
- - lib/cutword/get_string.rb
22
21
  - lib/cutword/version.rb
23
22
  homepage: https://github.com/demjhonsilver/cutword
24
23
  licenses:
@@ -32,15 +31,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
32
31
  requirements:
33
32
  - - ">="
34
33
  - !ruby/object:Gem::Version
35
- version: '0'
34
+ version: 3.0.0
36
35
  required_rubygems_version: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - ">="
37
+ - - ">"
39
38
  - !ruby/object:Gem::Version
40
- version: '0'
39
+ version: 1.3.1
41
40
  requirements: []
42
- rubygems_version: 3.4.20
41
+ rubygems_version: 3.4.10
43
42
  signing_key:
44
43
  specification_version: 4
45
- summary: A simple gem for cutting words/string truncation in Ruby on Rails.
44
+ summary: A simple gem for truncating words/strings or shortening words and names,
45
+ compatible with Rails and Hanami.
46
46
  test_files: []
@@ -1,12 +0,0 @@
1
- module Cutword
2
- class << self
3
- def get(text, max_length)
4
- if text.length > max_length
5
- truncated_text = text[0...max_length - 3].strip
6
- truncated_text + '...'
7
- else
8
- text
9
- end
10
- end
11
- end
12
- end