You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
394 B
Ruby
17 lines
394 B
Ruby
11 years ago
|
class AsciicastSnapshotUpdater
|
||
|
|
||
|
def update(asciicast, at_seconds = asciicast.duration / 2)
|
||
|
snapshot = generate_snapshot(asciicast, at_seconds)
|
||
|
asciicast.update_attribute(:snapshot, snapshot)
|
||
|
end
|
||
|
|
||
|
private
|
||
|
|
||
|
def generate_snapshot(asciicast, at_seconds)
|
||
|
asciicast.with_terminal do |terminal|
|
||
|
Film.new(asciicast.stdout, terminal).snapshot_at(at_seconds)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
end
|