aoc_utils 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/aoc_utils.rb +5 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56df3b1a821167f6333889fe6e630c4c6dbc7eaeb07087c58a4d085d30f6e9d2
4
- data.tar.gz: 833039ef582e37e2da240f602a55162afc42b341cf3dfb1ba079166dbd2fb677
3
+ metadata.gz: 040c3095a812f3c14566d221b44acb53bd2f2f1787c7881ccd9a75061f37730a
4
+ data.tar.gz: 70f8f5953faed22acf404ddac8fb030024290121e24f46a6983032b511f154b4
5
5
  SHA512:
6
- metadata.gz: 5fce022c24980b65d710a1c1be66b93074b281b463899b24e8ade14b41e1386dca91c3508f1f31dcb0d8e173cff235c9c243e211f76ff8eeeec7ceedec1fafd9
7
- data.tar.gz: 7a5ee3f1297e1d4498b9e53c439f57d4f94bcc63c21bbc71882dc813a155b597ebbaf91f4f3b29bca198613c0653720677af1ffe821312ab4cbf55045a5cd29c
6
+ metadata.gz: f965e4c23e79da146e0b711521247de292cfc8b7851e5b802a474c143b3765ae49f40e49e23747c65ccbe48786b09d99a06ec64f4262745a31c0b3c8dca163e2
7
+ data.tar.gz: 81f93a2d5ceb77c270f644e2d39c2ee4c6a2ddf0f99829abfc4049214ba8b83c1d3f1fd7cd6ebe5b42b7c5e3854db3e03fefc4c7a8379605e4616cc8dba25d1f
data/lib/aoc_utils.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  # Desc: Utility functions for Advent of Code problems
2
- module AocUtils
2
+ class AocUtils
3
3
  # extracts all integers from the specified file
4
4
  # @param filename [String] the name of the file to read from
5
5
  # @param other_characters [Array<String>] will save the first non integer character in the line for further usage
6
6
  # @return [Array<Array<Integer>>] an array of all the lines read from the file, with each line being an array of the integers read from that line
7
- def read_ints(filename, other_characters = [])
7
+ def self.read_ints(filename, other_characters = [])
8
8
  ints = []
9
9
  File.open(filename).each_line do |line|
10
10
  ints << line.scan(/-?\d+/).map(&:to_i)
@@ -16,7 +16,7 @@ module AocUtils
16
16
  # extracts all strings from the specified file
17
17
  # @param filename [String] the name of the file to read from
18
18
  # @return [Array<String>] an array of all the lines read from the file as strings with no leading or trailing whitespace
19
- def read_strings(filename)
19
+ def self.read_strings(filename)
20
20
  strings = []
21
21
  File.open(filename).each_line do |line|
22
22
  strings << line.strip
@@ -27,7 +27,7 @@ module AocUtils
27
27
  # extracts all characters from the specified file
28
28
  # @param filename [String] the name of the file to read from
29
29
  # @return [Array<Array<String>>] an array of all the lines read from the file, with each line being an array of the characters read from that line with no leading or trailing whitespace
30
- def read_chars(filename)
30
+ def self.read_chars(filename)
31
31
  chars = []
32
32
  File.open(filename).each_line do |line|
33
33
  chars << line.strip.chars
@@ -40,7 +40,7 @@ module AocUtils
40
40
  # @param datatype1 [String] the datatype of the first part of the file, either "Integer", "String", or "Char"
41
41
  # @param datatype2 [String] the datatype of the second part of the file, either "Integer", "String", or "Char"
42
42
  # @return [Array<Array>] an array containing two arrays, the first being the first part of the file and the second being the second part of the file
43
- def read_two_parts(filename, datatype1, datatype2)
43
+ def self.read_two_parts(filename, datatype1, datatype2)
44
44
  lines = File.open(filename).readlines.map(&:strip)
45
45
  index = lines.index("")
46
46
  part1 = lines[0...index]
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aoc_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
- - Lennard Clicqué
7
+ - Lennard Clicque
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []