Ruby STDIN conversion
This commit is contained in:
parent
5cc6c76ac1
commit
c619806f7b
@ -1,4 +1,4 @@
|
|||||||
input = File.read("../data/2015/1/input.txt").split("")
|
input = STDIN.read.split("")
|
||||||
counts = input.tally
|
counts = input.tally
|
||||||
final_floor = counts["("] - counts[")"]
|
final_floor = counts["("] - counts[")"]
|
||||||
puts "Part 1: #{final_floor}"
|
puts "Part 1: #{final_floor}"
|
||||||
|
10
ruby/bin/run
10
ruby/bin/run
@ -3,4 +3,12 @@
|
|||||||
year=$1
|
year=$1
|
||||||
day=$2
|
day=$2
|
||||||
|
|
||||||
time ruby $year/$day/problem.rb
|
mkdir -p $year/$day
|
||||||
|
source_file=$(ls $year/$day/*.rb)
|
||||||
|
|
||||||
|
if [[ -z $source_file ]] ; then
|
||||||
|
echo "No ruby source file found in $year/$day"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
time (cat ../data/$year/$day/input.txt | ruby $source_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user