strings 0.1.6 → 0.1.7

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: 921f81ef625130227be2240cdd40e00a88db1f902abd30af157833b31fc9e57c
4
- data.tar.gz: f26a6ca02ea2a3fb59cd81c4347ee2381f7b745c1b80975ce8e3262d33b91a9e
3
+ metadata.gz: 344e379be490559f0ca24d8b766edad6684d9e1d941f1d5afed88d9a918bb19b
4
+ data.tar.gz: a43a0198dbeaff865f6b56a056e8417553d0a094456a3a2899b3b06ba5168123
5
5
  SHA512:
6
- metadata.gz: 03de4bc3bc330b62ea283a86904edf9a67d2921c1c42c12e12168f5b4d1d306cabd2bee7bbfc519e70bdbfc5f2a93f356aa99a47b830e1b28135d1f07b42ec36
7
- data.tar.gz: 547a0b7849b8fa00db911f2e066cb0157f64cb5b169f64d5f62068f0e34be387b86bf862edefee08c6d98598d7f37f37416ea480bd58e2cff0338b1fb8ab31cc
6
+ metadata.gz: 53ee9e47ec42870eb2bd8661089d4dd8b9eadbd61de7ddc2a1928f180f4fe826925d783e85b1b7930e316fada17e1e5aeef1f5e90247d9e9278c0e5812c03f84
7
+ data.tar.gz: 64fa7df77eb99d4d7d48fd6d6b55d09ad8ffec2de3e87cbe751007c681f9654daee704ae002ab5fcfa4a575eaf858f49e94e516d11243ff749aeabfbcda044d8
@@ -1,5 +1,13 @@
1
1
  # Change log
2
2
 
3
+ ## [v0.1.7] - 2019-11-14
4
+
5
+ ### Added
6
+ * Add metadata to gemspec
7
+
8
+ ### Fixed
9
+ * Fix Truncate#truncate to accept length of 1 by Katelyn Schiesser(@slowbro)
10
+
3
11
  ## [v0.1.6] - 2019-08-28
4
12
 
5
13
  ### Changed
@@ -40,7 +48,8 @@
40
48
 
41
49
  * Initial implementation and release
42
50
 
43
- [v0.1.6]: https://github.com/piotrmurach/strings/compare/v0.1.4...v0.1.5
51
+ [v0.1.7]: https://github.com/piotrmurach/strings/compare/v0.1.6...v0.1.7
52
+ [v0.1.6]: https://github.com/piotrmurach/strings/compare/v0.1.5...v0.1.6
44
53
  [v0.1.5]: https://github.com/piotrmurach/strings/compare/v0.1.4...v0.1.5
45
54
  [v0.1.4]: https://github.com/piotrmurach/strings/compare/v0.1.3...v0.1.4
46
55
  [v0.1.3]: https://github.com/piotrmurach/strings/compare/v0.1.2...v0.1.3
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <div align="center">
2
- <img width="225" src="https://cdn.rawgit.com/piotrmurach/strings/master/assets/strings_logo.png" alt="strings logo" />
2
+ <img width="225" src="https://github.com/piotrmurach/strings/blob/master/assets/strings_logo.png" alt="strings logo" />
3
3
  </div>
4
4
 
5
5
  # Strings
@@ -43,6 +43,7 @@ Or install it yourself as:
43
43
  * Supports multibyte character encodings such as UTF-8, EUC-JP
44
44
  * Handles languages without white-spaces between words (like Chinese and Japanese)
45
45
  * Supports ANSI escape codes
46
+ * Flexible by nature, split into [components](#4-components)
46
47
 
47
48
  ## Contents
48
49
 
@@ -56,7 +57,7 @@ Or install it yourself as:
56
57
  * [2.6 truncate](#26-truncate)
57
58
  * [2.7 wrap](#27-wrap)
58
59
  * [3. Extending String class](#3-extending-string-class)
59
- * [4. Utilities](#4-utilities)
60
+ * [4. Components](#4-components)
60
61
 
61
62
  ## 1. Usage
62
63
 
@@ -368,13 +369,14 @@ require 'strings/extensions'
368
369
  using Strings::Extensions
369
370
  ```
370
371
 
371
- ## 4. Utilities
372
+ ## 4. Components
372
373
 
373
- **Strings** aims to be flexible and allow you to choose only the utilities that you need. Currently you can choose from:
374
+ **Strings** aims to be flexible and allow you to choose only the components that you need. Currently you can choose from:
374
375
 
375
- | Utility | Description | API docs |
376
+ | Component | Description | API docs |
376
377
  | ------------ | ----------- | -------- |
377
378
  | [strings-ansi](https://github.com/piotrmurach/strings-ansi) | Handle ANSI escape codes in strings. | [docs](http://www.rubydoc.info/gems/strings-ansi) |
379
+ | [strings-case](https://github.com/piotrmurach/strings-case) | Handle case transformations in strings. | [docs](http://www.rubydoc.info/gems/strings-case) |
378
380
 
379
381
  ## Development
380
382
 
@@ -70,6 +70,7 @@ module Strings
70
70
  # @api private
71
71
  def shorten(original_chars, chars, length_without_trailing)
72
72
  truncated = []
73
+ return truncated if length_without_trailing.zero?
73
74
  char_width = display_width(chars[0])
74
75
  while length_without_trailing - char_width > 0
75
76
  orig_char = original_chars.shift
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Strings
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end # Strings
@@ -11,6 +11,10 @@ RSpec.describe Strings::Truncate, '#truncate' do
11
11
  expect(Strings::Truncate.truncate(text, nil)).to eq(text)
12
12
  end
13
13
 
14
+ it "truncate length of 1 results in just the trailing character" do
15
+ expect(Strings::Truncate.truncate(text, 1)).to eq(Strings::Truncate::DEFAULT_TRAILING)
16
+ end
17
+
14
18
  it "doesn't change text for equal length" do
15
19
  truncation = Strings::Truncate.truncate(text, text.length * 2)
16
20
  expect(truncation).to eq(text)
@@ -9,9 +9,15 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ["me@piotrmurach.com"]
10
10
  spec.summary = %q{A set of useful functions for transforming strings.}
11
11
  spec.description = %q{A set of useful functions such as fold, truncate, wrap and more for transoforming strings.}
12
- spec.homepage = ""
12
+ spec.homepage = "https://github.com/piotrmurach/strings"
13
13
  spec.license = "MIT"
14
14
 
15
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
16
+ spec.metadata["changelog_uri"] = "https://github.com/piotrmurach/strings/blob/master/CHANGELOG.md"
17
+ spec.metadata["documentation_uri"] = "https://www.rubydoc.info/gems/strings"
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/piotrmurach/strings"
20
+
15
21
  spec.files = Dir['{lib,spec}/**/*.rb', '{bin,tasks}/*', 'strings.gemspec']
16
22
  spec.files += Dir['README.md', 'CHANGELOG.md', 'LICENSE.txt', 'Rakefile']
17
23
  spec.bindir = "exe"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Murach
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-28 00:00:00.000000000 Z
11
+ date: 2019-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: strings-ansi
@@ -139,10 +139,15 @@ files:
139
139
  - tasks/console.rake
140
140
  - tasks/coverage.rake
141
141
  - tasks/spec.rake
142
- homepage: ''
142
+ homepage: https://github.com/piotrmurach/strings
143
143
  licenses:
144
144
  - MIT
145
- metadata: {}
145
+ metadata:
146
+ allowed_push_host: https://rubygems.org
147
+ changelog_uri: https://github.com/piotrmurach/strings/blob/master/CHANGELOG.md
148
+ documentation_uri: https://www.rubydoc.info/gems/strings
149
+ homepage_uri: https://github.com/piotrmurach/strings
150
+ source_code_uri: https://github.com/piotrmurach/strings
146
151
  post_install_message:
147
152
  rdoc_options: []
148
153
  require_paths: