Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
inukshuk committed Apr 6, 2020
1 parent 5798e24 commit e8c822a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Metrics/BlockNesting:
# Offense count: 14
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 600
Max: 700

# Offense count: 15
Metrics/CyclomaticComplexity:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
bibtex-ruby (5.1.1)
bibtex-ruby (5.1.3)
latex-decode (~> 0.0)

GEM
Expand Down
7 changes: 6 additions & 1 deletion lib/bibtex/value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ def join(separator = '')
# If the option :filter is given, the Value will be converted using
# the filter(s) specified.
def to_s(options = {})
return convert(options[:filter]).to_s(options.reject { |k,| k == :filter || (k == :quotes && (!atomic? || symbol?)) }) if options.key?(:filter)
if options.key?(:filter)
return convert(options[:filter]).to_s(
options.reject { |k,| k == :filter || (k == :quotes && (!atomic? || symbol?)) }
)
end

return value.to_s unless options.key?(:quotes) && atomic? && !symbol?

q = Array(options[:quotes])
Expand Down
6 changes: 3 additions & 3 deletions test/bibtex/test_entry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -485,22 +485,22 @@ def @filter.apply(value)

describe '#to_s' do
before do
@bib = Bibliography.parse(<<-BIBINPUT, { :parse_months => false })
@bib = Bibliography.parse(<<-BIBINPUT, parse_months: false)
@misc{foo,
title = {A
title},
series = {A
series},
month = dec
}
BIBINPUT
BIBINPUT
end
it 'applies filters when converting to strings' do
assert_equal "@misc{foo,\n"\
" title = {A title},\n"\
" series = {A series},\n"\
" month = dec\n"\
"}\n", @bib['foo'].to_s({ filter: :linebreaks })
"}\n", @bib['foo'].to_s(filter: :linebreaks)
end
end

Expand Down

0 comments on commit e8c822a

Please sign in to comment.