INNER CODE UNIT · Ruby
write_to_theme_file
Automattic/pocket-casts-android · scripts/themes/generate_xml.rb:8
def write_to_theme_file(output, file_marker)
contents = File.read(THEME_FILE)
new_contents = String.new('')
reading = true
contents.lines.each do |line|
reading = true if line.include?("#{file_marker} - WARNING AUTO GENERATED, DO NOT EDIT - end")
new_contents << line if reading
if line.include?("#{file_marker} - WARNING AUTO GENERATED, DO NOT EDIT - begin")
reading = false
new_contents << output
end
end
File.write(THEME_FILE, new_contents)
end
def write_theme_attrs(tokens)
output = ''
tokens.each do |token_attrs|