aoc_utils 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aoc_utils.rb +5 -3
  3. metadata +3 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91281ea705349ee1f046ff24cc48e6f888c9b26859661127b17ec41adf45aa37
4
- data.tar.gz: 735ae0c912af26338c320a317fccb835dabfc1b7120ec40ae9f3db28d5db5018
3
+ metadata.gz: 97ef492a117091eda00920c4e60c43df387d60a498028d8a4040b5b785cb4c99
4
+ data.tar.gz: 1834bc6d06f53bbb1636516a6db1fc1c11883e65de57e01d89185b9b4e054dcb
5
5
  SHA512:
6
- metadata.gz: e4653b0d8fee196d782516f640e5936b8dac44529736c241634f4926606339c7acb1cc9ae1ccf5b3964d24a0f98d500bc50e960c934db77df3e2251ac10cfef1
7
- data.tar.gz: 87e45458fb2568de4d758640c3fd94ada91380c62fca519e7215cb2c93014507f6e4bc406628bf104b10aa3e88bb871186d93e2877d835f9e935cded20bed4c2
6
+ metadata.gz: 8735386433707f537a2575088b1cab91f9c203e188fbd1fe43dd351875b556984f011429585b65a2462fd4dea69c87fca84d5f7f9e5573a9033b7d2c6588a455
7
+ data.tar.gz: 399474e872d895f5a5ebf4427e65139d691e07b11e01bf284b79fe4409912d0bd131b7a2b894f1ac68ede044bad6e543aec5aaede5adedec293140eb0c6e3dc9
data/lib/aoc_utils.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  # Desc: Utility functions for Advent of Code problems
2
2
  module AocUtils
3
+
4
+
3
5
  # extracts all integers from the specified file
4
6
  # @param filename [String] the name of the file to read from
5
7
  # @param other_characters [Array<String>] will save the first non integer character in the line for further usage
@@ -44,14 +46,14 @@ module AocUtils
44
46
  lines = File.open(filename).readlines.map(&:strip)
45
47
  index = lines.index("")
46
48
  part1 = lines[0...index]
47
- part2 = lines[(index + 1)..-1]
49
+ part2 = lines[(index + 1)..]
48
50
  case datatype1
49
51
  when "Integer"
50
52
  part1 = part1.map { |line| line.scan(/-?\d+/).map(&:to_i) }
51
53
  when "String"
52
54
  part1 = part1.map { |string| string.split(",").map(&:strip) }.flatten
53
55
  when "Char"
54
- part1.strip!
56
+ part1.map!(&:strip)
55
57
  part1 = part1.map(&:chars)
56
58
  else
57
59
  raise "Invalid datatype"
@@ -62,7 +64,7 @@ module AocUtils
62
64
  when "String"
63
65
  part2 = part2.map { |string| string.split(",").map(&:strip) }.flatten
64
66
  when "Char"
65
- part2.strip!
67
+ part2.map!(&:strip)
66
68
  part2 = part2.map(&:chars)
67
69
  end
68
70
  [part1, part2]
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aoc_utils
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
  - Lennard Clicque
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-10-28 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: A collection of utility methods for Advent of Code
14
13
  email: l.clicque@gmail.com
@@ -21,7 +20,6 @@ homepage: https://rubygems.org/gems/aoc_utils
21
20
  licenses:
22
21
  - MIT
23
22
  metadata: {}
24
- post_install_message:
25
23
  rdoc_options: []
26
24
  require_paths:
27
25
  - lib
@@ -36,8 +34,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
34
  - !ruby/object:Gem::Version
37
35
  version: '0'
38
36
  requirements: []
39
- rubygems_version: 3.5.22
40
- signing_key:
37
+ rubygems_version: 3.7.2
41
38
  specification_version: 4
42
39
  summary: A collection of utility methods for Advent of Code
43
40
  test_files: []