This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "miNitest/autorun" | |
require "debug" | |
class SafetyManual | |
attr_reader :rules, :pages | |
def initialize(input) | |
@rules, @pages = parse input | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
INPUT = DATA.read | |
class WordSearch | |
attr_reader :grid | |
def initialize(input) | |
@grid = parse input | |
@max_row = grid.count - 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
class Recovery | |
def initialize(input, parser: BasicParser) | |
@input = input | |
@parser = parser | |
end | |
def total | |
data.sum { |x, y| x.to_i * y.to_i } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
class Reactor | |
attr_reader :data | |
def initialize(input) | |
@data = parse input | |
end | |
def safe_count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
INPUT = DATA.read | |
class LocationDataTest < Minitest::Test | |
def test_total_distance | |
location_list = LocationData.new(INPUT) | |
assert_equal 11, location_list.total_distance | |
end |