Skip to content

Commit

Permalink
Remove automatically open files via parse
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Jan 6, 2023
1 parent 5f5f3fa commit 660c0d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions lib/anystyle/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ def prepare(input, **opts)
expand input
when Wapiti::Sequence
expand Wapiti::Dataset.new([input])
when String
if input.length < 1024 && File.exist?(input)
expand Wapiti::Dataset.open(input, **opts)
else
expand Wapiti::Dataset.parse(input, **opts)
end
else
expand Wapiti::Dataset.parse(input, **opts)
end
Expand Down
5 changes: 4 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ module Resources
PATH = File.expand_path('../../res', __FILE__)

def resource(name = 'parser/core.xml', format: 'hash', **opts)
AnyStyle::Parser.new.parse File.join(PATH, name), format: format, **opts
AnyStyle::Parser.new.parse(
Wapiti::Dataset.open(File.join(PATH, name)),
format: format, **opts
)
end
end

Expand Down

0 comments on commit 660c0d6

Please sign in to comment.