subvisual-utils 0.2.0 → 0.3.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: 3e06a11e616f5f329837b8446e9435f4a92ac97c479b83b71d65e47fcf087aad
4
- data.tar.gz: c9066f71c06801f9c8eae2f97bf5f84386508ba795b17b2fd4051aa0b77d2e64
3
+ metadata.gz: 2e8becccaf7396ede4dae0b495394f830089cd0dc4b6bc422bb52d268f7929f7
4
+ data.tar.gz: 888fd5ca1b5ed5205d0997b9d2541cd5d050ec77eed9c0a10ff42b10df397f35
5
5
  SHA512:
6
- metadata.gz: 693ca65ca473999ba2817f7d14935175485f4bd9966d498631b6fe2e1a28b19e31622a8444dd1777daa5fc59205b9809456d3c7665425bb094818caa236a6a1e
7
- data.tar.gz: bfaac0e139f9ed70af40ab92936b363d328f0052de008bb311d6655b7c36354779e197a8df3440925425d0451c1898d274fde5be9c034c80866fdb4344caae5b
6
+ metadata.gz: d21f6ed2583a8a8f0cbaf5bd1a7fcb6bc090c4ba1ebd0bde7481bafcef20da3ae6a7d5dd8c23142ce5fb2fd77f9ca7a8d8538b79bb0e737038edf58c54cbc814
7
+ data.tar.gz: 7c5cfc76288b4aa836079650e04df7f4dcacd151e1fca0de2963ff31d186393521581355bd1236db9a8aaa78503f638b844c9d90e452bb2892d372d04a11b544
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning].
11
11
  Unreleased
12
12
  ----------
13
13
 
14
+ - Added `StringUtils.replace_at(string, index, replacement)`.
15
+
16
+
17
+ v0.2.0 - 2020-05-07
18
+ -------------------
19
+
14
20
  - Added `ArrayUtils.pad_right(array, size, padding = nil)`.
15
21
 
16
22
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- subvisual-utils (0.2.0)
4
+ subvisual-utils (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -55,6 +55,15 @@ Subvisual::MathUtils.least_common_denominator(21, 6) # => 42
55
55
  ```
56
56
 
57
57
 
58
+ ### `Subvisual::StringUtils.replace_at(string, index, replacement)`
59
+
60
+ Replaces the character at a specific index in a String.
61
+
62
+ ```ruby
63
+ Subvisual::StringUtils.replace_at("Hello", 1, "a") # => "Hallo"
64
+ ```
65
+
66
+
58
67
  Development
59
68
  -----------
60
69
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "subvisual/string_utils/replace_at"
4
+
5
+ module Subvisual
6
+ module StringUtils
7
+ extend ReplaceAt
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Subvisual
4
+ module StringUtils
5
+ module ReplaceAt
6
+ def replace_at(string, index, replacement)
7
+ string.chars.tap do |characters|
8
+ characters[index] = replacement
9
+ end.join
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Subvisual
4
4
  module Utils
5
- VERSION = "0.2.0"
5
+ VERSION = "0.3.0"
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Costa
@@ -32,6 +32,8 @@ files:
32
32
  - lib/subvisual/math_utils.rb
33
33
  - lib/subvisual/math_utils/greatest_common_divisor.rb
34
34
  - lib/subvisual/math_utils/least_common_denominator.rb
35
+ - lib/subvisual/string_utils.rb
36
+ - lib/subvisual/string_utils/replace_at.rb
35
37
  - lib/subvisual/utils.rb
36
38
  - subvisual-utils.gemspec
37
39
  homepage: https://github.com/subvisual/ruby-utils