Read asciicast directly from URL

private-asciicasts
Marcin Kulik 9 years ago
parent 770571d0bd
commit f45ff47737

@ -80,8 +80,7 @@ class Asciicast < ActiveRecord::Base
Stdout::MultiFile.new(stdout_data.decompressed_path,
stdout_timing.decompressed_path)
else
file.cache!
Stdout::SingleFile.new(file.current_path)
Stdout::SingleFile.new(file.url)
end
end

@ -1,3 +1,5 @@
require 'open-uri'
class Stdout
include Enumerable
@ -9,7 +11,7 @@ class Stdout
end
def each(&blk)
File.open(path, 'r') do |f|
open(path, 'r') do |f|
Oj.sc_parse(FrameIterator.new(blk), f)
end
end

@ -1,3 +1,13 @@
class AsciicastUploader < BaseUploader
def url
url = super
if url[0] == '/'
path
else
url
end
end
end

Loading…
Cancel
Save