Class: EDL::CommentMatcher

Inherits:
Matcher
  • Object
show all
Defined in:
lib/edl.rb

Overview

EDL clip comment matcher, a generic one

Instance Method Summary collapse

Methods inherited from Matcher

#matches?

Constructor Details

#initializeCommentMatcher

Returns a new instance of CommentMatcher.



160
161
162
# File 'lib/edl.rb', line 160

def initialize
  super(/^\*(.+)/)
end

Instance Method Details

#apply(stack, line) ⇒ Object

Raises:



164
165
166
167
168
# File 'lib/edl.rb', line 164

def apply(stack, line)
  raise ApplyError.new('No event to attach a comment to', line) if stack.empty?
  # TODO: we should really remove "* " prefixes from comments
  stack[-1].comments.push('* %s' % line.scan(@regexp).flatten.pop.strip)
end