Clean up parse method
This commit is contained in:
parent
4c72a5dbf6
commit
c791500663
1 changed files with 6 additions and 4 deletions
|
|
@ -6,10 +6,12 @@ module Intcode
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.parse(input)
|
def self.parse(input)
|
||||||
cleaned = input
|
parsed = input
|
||||||
.gsub(/^#.*$/, '')
|
.gsub(/^#.*$/, '')
|
||||||
.gsub('\s', '')
|
.gsub('\s', '')
|
||||||
Program.new cleaned.split(',').map(&:to_i)
|
.split(',')
|
||||||
|
.map(&:to_i)
|
||||||
|
Program.new parsed
|
||||||
end
|
end
|
||||||
|
|
||||||
class Memory < Array
|
class Memory < Array
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue