strings 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +10 -10
- data/lib/strings/version.rb +1 -1
- data/strings.gemspec +7 -9
- metadata +20 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59762ac60270a0fa21a1989b6ec1bf8b98eac632fc9ff8c091ef7dd711a8baf8
|
4
|
+
data.tar.gz: 43276937aaef5a75cb43e8e29a6ea9f5f09b4488d22a84a03fa128de07840afb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29244946de99fa208749f9ca7f88010b70b466f0d29583f76b9b982b9b299a69b14a1f76a43cd537f46e758f2f7e3e40f057d6506650b67fcd84d6e788f127c0
|
7
|
+
data.tar.gz: 6d8b306a59eaafb78308e293739dadaaded471ef2a97daffc3cf31681a490df05067845600faed4b2fdcf390aa307016934f07751a7d3aa5c5fff49363162812
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
## [v0.1.5] - 2019-03-29
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
* Change to update unicode-display_width to the latest version
|
7
|
+
* Change to relax development dependencies versions
|
8
|
+
|
3
9
|
## [v0.1.4] - 2018-09-10
|
4
10
|
|
5
11
|
### Fixed
|
@@ -22,8 +28,9 @@
|
|
22
28
|
|
23
29
|
## [v0.1.0] - 2018-01-07
|
24
30
|
|
25
|
-
*
|
31
|
+
* Initial implementation and release
|
26
32
|
|
33
|
+
[v0.1.5]: https://github.com/piotrmurach/strings/compare/v0.1.4...v0.1.5
|
27
34
|
[v0.1.4]: https://github.com/piotrmurach/strings/compare/v0.1.3...v0.1.4
|
28
35
|
[v0.1.3]: https://github.com/piotrmurach/strings/compare/v0.1.2...v0.1.3
|
29
36
|
[v0.1.2]: https://github.com/piotrmurach/strings/compare/v0.1.1...v0.1.2
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ Or install it yourself as:
|
|
41
41
|
* No monkey-patching String class
|
42
42
|
* Functional API that can be easily wrapped by other objects
|
43
43
|
* Supports multibyte character encodings such as UTF-8, EUC-JP
|
44
|
-
* Handles languages without
|
44
|
+
* Handles languages without white-spaces between words (like Chinese and Japanese)
|
45
45
|
* Supports ANSI escape codes
|
46
46
|
|
47
47
|
## Contents
|
@@ -132,14 +132,14 @@ Strings.align_left(text, 20)
|
|
132
132
|
|
133
133
|
### 2.2 ansi?
|
134
134
|
|
135
|
-
To check if a string includes ANSI escape codes use `ansi?` like so:
|
135
|
+
To check if a string includes ANSI escape codes use `ansi?` method like so:
|
136
136
|
|
137
137
|
```ruby
|
138
138
|
Strings.ansi?("\e[33;44mfoo\e[0m")
|
139
139
|
# => true
|
140
140
|
```
|
141
141
|
|
142
|
-
|
142
|
+
Or fully qualified name:
|
143
143
|
|
144
144
|
```ruby
|
145
145
|
Strings::ANSI.ansi?("\e[33;44mfoo\e[0m")
|
@@ -148,7 +148,7 @@ Strings::ANSI.ansi?("\e[33;44mfoo\e[0m")
|
|
148
148
|
|
149
149
|
### 2.3 fold
|
150
150
|
|
151
|
-
To fold a multiline text into a single line preserving
|
151
|
+
To fold a multiline text into a single line preserving white-space characters use `fold`:
|
152
152
|
|
153
153
|
```ruby
|
154
154
|
Strings.fold("\tfoo \r\n\n bar")
|
@@ -277,7 +277,7 @@ text = 'ラドクリフ、マラソン五輪代表に1万m出場にも含み'
|
|
277
277
|
Strings.truncate(text, 12) # => "ラドクリフ…"
|
278
278
|
```
|
279
279
|
|
280
|
-
**Strings::Truncate** works with ANSI escape
|
280
|
+
**Strings::Truncate** works with ANSI escape codes:
|
281
281
|
|
282
282
|
```ruby
|
283
283
|
text = "I try \e[34mall things\e[0m, I achieve what I can"
|
@@ -287,7 +287,7 @@ Strings.truncate(text, 18)
|
|
287
287
|
|
288
288
|
### 2.7 wrap
|
289
289
|
|
290
|
-
To wrap text into lines no longer than `wrap_at` argument length, the `wrap` method will break either on
|
290
|
+
To wrap text into lines no longer than `wrap_at` argument length, the `wrap` method will break either on white-space character or in case of east Asian characters on character boundaries.
|
291
291
|
|
292
292
|
Given the following text:
|
293
293
|
|
@@ -338,7 +338,7 @@ Strings::Wrap.wrap(text, wrap_at)
|
|
338
338
|
|
339
339
|
## 3. Extending String class
|
340
340
|
|
341
|
-
Though it is highly discouraged to
|
341
|
+
Though it is highly discouraged to pollute core Ruby classes, you can add the required methods to `String` class by using refinements.
|
342
342
|
|
343
343
|
For example, if you wish to only extend strings with `wrap` method do:
|
344
344
|
|
@@ -352,7 +352,7 @@ module MyStringExt
|
|
352
352
|
end
|
353
353
|
```
|
354
354
|
|
355
|
-
|
355
|
+
Then `wrap` method will be available for any strings where refinement is applied:
|
356
356
|
|
357
357
|
```ruby
|
358
358
|
using MyStringExt
|
@@ -370,7 +370,7 @@ using Strings::Extensions
|
|
370
370
|
|
371
371
|
## 4. Utilities
|
372
372
|
|
373
|
-
**Strings** aims to be
|
373
|
+
**Strings** aims to be flexible and allow you to choose only the utilities that you need. Currently you can choose from:
|
374
374
|
|
375
375
|
| Utility | Description | API docs |
|
376
376
|
| ------------ | ----------- | -------- |
|
@@ -402,4 +402,4 @@ Everyone interacting in the Strings project’s codebases, issue trackers, chat
|
|
402
402
|
|
403
403
|
## Copyright
|
404
404
|
|
405
|
-
Copyright (c) 2017
|
405
|
+
Copyright (c) 2017 Piotr Murach. See LICENSE for further details.
|
data/lib/strings/version.rb
CHANGED
data/strings.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "strings/version"
|
@@ -7,8 +6,7 @@ Gem::Specification.new do |spec|
|
|
7
6
|
spec.name = "strings"
|
8
7
|
spec.version = Strings::VERSION
|
9
8
|
spec.authors = ["Piotr Murach"]
|
10
|
-
spec.email = [""]
|
11
|
-
|
9
|
+
spec.email = ["me@piotrmurach.com"]
|
12
10
|
spec.summary = %q{A set of useful functions for transforming strings.}
|
13
11
|
spec.description = %q{A set of useful functions such as fold, truncate, wrap and more for transoforming strings.}
|
14
12
|
spec.homepage = ""
|
@@ -20,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
20
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
19
|
spec.require_paths = ["lib"]
|
22
20
|
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency
|
21
|
+
spec.add_dependency "strings-ansi", "~> 0.1"
|
22
|
+
spec.add_dependency "unicode_utils", "~> 1.4"
|
23
|
+
spec.add_dependency "unicode-display_width", "~> 1.5"
|
26
24
|
|
27
|
-
spec.add_development_dependency "bundler", "
|
28
|
-
spec.add_development_dependency "rake"
|
29
|
-
spec.add_development_dependency "rspec", "
|
25
|
+
spec.add_development_dependency "bundler", ">= 1.5"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec", ">= 3.0"
|
30
28
|
end
|
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.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Murach
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: strings-ansi
|
@@ -16,88 +16,88 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.1
|
19
|
+
version: '0.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.1
|
26
|
+
version: '0.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: unicode_utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.4
|
33
|
+
version: '1.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.4
|
40
|
+
version: '1.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: unicode-display_width
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: '1.5'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: '1.5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.0'
|
97
97
|
description: A set of useful functions such as fold, truncate, wrap and more for transoforming
|
98
98
|
strings.
|
99
99
|
email:
|
100
|
-
-
|
100
|
+
- me@piotrmurach.com
|
101
101
|
executables: []
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
@@ -157,8 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
159
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.7.3
|
160
|
+
rubygems_version: 3.0.3
|
162
161
|
signing_key:
|
163
162
|
specification_version: 4
|
164
163
|
summary: A set of useful functions for transforming strings.
|