From 6f8943d5232d73197d8d94e3de15cae425847434 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Mon, 22 Jan 2024 01:44:05 -0700 Subject: [PATCH] remove explicit to_proc calls when passing method references; add notes when coersion to proc is needed --- lib/asciidoctor/pdf/converter.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/asciidoctor/pdf/converter.rb b/lib/asciidoctor/pdf/converter.rb index a9dee091b..e28d5f95e 100644 --- a/lib/asciidoctor/pdf/converter.rb +++ b/lib/asciidoctor/pdf/converter.rb @@ -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 @@ -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 @@ -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