Skip to content

Commit

Permalink
remove explicit to_proc calls when passing method references; add not…
Browse files Browse the repository at this point in the history
…es when coersion to proc is needed
  • Loading branch information
mojavelinux committed Jan 22, 2024
1 parent 188679f commit b4c8dc0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/asciidoctor/pdf/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ def init_pdf doc
# scratch calls init_scratch on a copy of the prototype to instantiate a scratch document
# push_scratch and pop_scratch make changes to the document catalog and attributes transactional
allocate_scratch_prototype
# NOTE: & prefix required here to pass resolved method as block of on_page_create method
on_page_create(&(method :init_page).curry[doc])
self
end
Expand Down Expand Up @@ -638,7 +639,7 @@ def convert_section sect, _opts = nil
return convert_abstract sect
elsif (index_section = sectname == 'index') && @index.empty?
# override numbered_title to hide entry from TOC
sect.define_singleton_method :numbered_title, &->(*) { '' }
sect.define_singleton_method :numbered_title, ->(*) { '' }
return
end
title = sect.numbered_title formal: true
Expand Down Expand Up @@ -3725,7 +3726,8 @@ def ink_running_content periphery, doc, skip = [1, 1], body_start_page_number =
# NOTE: force repeater to consult color spaces on current page instead of the page on which repeater was created
# if this stops working, use the commented code above repeat call instead
unless (repeater_graphic_state = repeaters[-1].instance_variable_get :@graphic_state).singleton_methods.include? :color_space
repeater_graphic_state.define_singleton_method :color_space, &(method :page_color_space)
# NOTE: must convert override method to proc since we're are changing bind argument
repeater_graphic_state.define_singleton_method :color_space, (method :page_color_space).to_proc
end
go_to_page prev_page_number
nil
Expand Down

0 comments on commit b4c8dc0

Please sign in to comment.