Skip to content

Commit

Permalink
lib/lingo/filter/: Yield individual lines.
Browse files Browse the repository at this point in the history
Related to lex-lingo#15.
  • Loading branch information
blackwinter committed Feb 2, 2016
1 parent ec85ddf commit 66410b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/lingo/filter/pdf.rb
Expand Up @@ -37,8 +37,8 @@ def initialize(*args)
@obj = ::PDF::Reader.new(@io)
end

def each
@obj.pages.each { |x| yield x.text }
def each(&block)
@obj.pages.each { |x| x.text.each_line(&block) }
end

end
Expand Down
4 changes: 2 additions & 2 deletions lib/lingo/filter/xml.rb
Expand Up @@ -39,8 +39,8 @@ def initialize(*args)
@obj = Nokogiri.send(self.class::TYPE, @io, nil, @encoding)
end

def each
@obj.children.each { |n| yield n.content }
def each(&block)
@obj.root.element_children.each { |n| n.content.each_line(&block) }
end

end
Expand Down

0 comments on commit 66410b4

Please sign in to comment.