subvisual-utils 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e8becccaf7396ede4dae0b495394f830089cd0dc4b6bc422bb52d268f7929f7
4
- data.tar.gz: 888fd5ca1b5ed5205d0997b9d2541cd5d050ec77eed9c0a10ff42b10df397f35
3
+ metadata.gz: 023b58b199b9147c577c5d4cb7ec7a8229db991e60ee67b88c5b837c1e73f6fd
4
+ data.tar.gz: 5b450502ac3aa6cdc8611964e8fe8a6aca2c99d9b91a27b20f96dc302fb9235f
5
5
  SHA512:
6
- metadata.gz: d21f6ed2583a8a8f0cbaf5bd1a7fcb6bc090c4ba1ebd0bde7481bafcef20da3ae6a7d5dd8c23142ce5fb2fd77f9ca7a8d8538b79bb0e737038edf58c54cbc814
7
- data.tar.gz: 7c5cfc76288b4aa836079650e04df7f4dcacd151e1fca0de2963ff31d186393521581355bd1236db9a8aaa78503f638b844c9d90e452bb2892d372d04a11b544
6
+ metadata.gz: 34c6f7aed372440c0b2a5a4947e8f5083d5c79dfdeb3b607017d2042d1f68266eef1b22996f22b7beb9610ad04f6c6a709fff3c5953c89481fd287fb29d80cf3
7
+ data.tar.gz: f17e7e041106d725670b770923578f0f044a3b425292e53ce001dac19c110a2234bca1ba0db88c162a7c0c94f6286b5c0fb31c2c35887bb262980a2460e75acc
@@ -11,6 +11,13 @@ and this project adheres to [Semantic Versioning].
11
11
  Unreleased
12
12
  ----------
13
13
 
14
+ - Changed `StringUtils.replace_at(string, index, replacement)` to accept a list
15
+ of indices to replace.
16
+
17
+
18
+ v0.3.0 - 2020-05-07
19
+ -------------------
20
+
14
21
  - Added `StringUtils.replace_at(string, index, replacement)`.
15
22
 
16
23
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- subvisual-utils (0.3.0)
4
+ subvisual-utils (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -57,7 +57,7 @@ Subvisual::MathUtils.least_common_denominator(21, 6) # => 42
57
57
 
58
58
  ### `Subvisual::StringUtils.replace_at(string, index, replacement)`
59
59
 
60
- Replaces the character at a specific index in a String.
60
+ Replaces the character at a specific index, or indices, in a String.
61
61
 
62
62
  ```ruby
63
63
  Subvisual::StringUtils.replace_at("Hello", 1, "a") # => "Hallo"
@@ -4,8 +4,12 @@ module Subvisual
4
4
  module StringUtils
5
5
  module ReplaceAt
6
6
  def replace_at(string, index, replacement)
7
+ indices = index.is_a?(Enumerable) ? index : [index]
8
+
7
9
  string.chars.tap do |characters|
8
- characters[index] = replacement
10
+ indices.each do |i|
11
+ characters[i] = replacement
12
+ end
9
13
  end.join
10
14
  end
11
15
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Subvisual
4
4
  module Utils
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subvisual-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Costa