Skip to content

Add attribute :force to RDoc::RubygemsHook just like RDoc::RubyGemsHook - #1244

Merged
st0012 merged 1 commit into
ruby:masterfrom
tompng:rubygems_hook_accessors
Dec 16, 2024
Merged

st0012 merged 1 commit into
ruby:masterfrom
tompng:rubygems_hook_accessors

Conversation

@tompng

@tompng tompng commented Dec 15, 2024

Copy link
Copy Markdown
Member

Rubygems creates an instance of RDoc::RubygemsHook, sets doc.force = overwrite, then calls doc.generate the document. RDoc::RubygemsHook needs attribute :force just like RDoc::RubyGemsHook.

Fixes #1243

Rubygems creates an instance of RDoc::RubygemsHook, sets `doc.force = overwrite`, then calls `doc.generate` the document.
RDoc::RubygemsHook needs attribute `:force` just like RDoc::RubyGemsHook.
@tompng
tompng force-pushed the rubygems_hook_accessors branch from 08aec15 to 6f50059 Compare December 15, 2024 16:01
Comment thread lib/rdoc/rubygems_hook.rb
@@ -281,14 +281,17 @@ def initialize(spec, generate_rdoc = false, generate_ri = true)
@spec = spec
@generate_rdoc = generate_rdoc
@generate_ri = generate_ri

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that we can initialize a RubyGemsHook here already, like

    def initialize(spec, generate_rdoc = false, generate_ri = true)
      @rubygems_hook = RubyGemsHook.new(spec, generate_rdoc, generate_ri)
    end

And then delegate methods to @rubygems_hook, which will handle more cases 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, implementing minimal things to clarify what method/attribute are needed in the compatibility layer is not a bad idea. I think it is the intention of the current implementation of RubygemsHook. (I', not sure)
This way, the new RubyGemsHook can easily change its method as long as RubygemsHook's methods works.

@st0012 st0012 added the bug label Dec 16, 2024
@st0012
st0012 merged commit 01bdbcd into ruby:master Dec 16, 2024
matzbot pushed a commit to ruby/ruby that referenced this pull request Dec 16, 2024
RDoc::RubyGemsHook
(ruby/rdoc#1244)

Rubygems creates an instance of RDoc::RubygemsHook, sets `doc.force = overwrite`, then calls `doc.generate` the document.
RDoc::RubygemsHook needs attribute `:force` just like RDoc::RubyGemsHook.

ruby/rdoc@01bdbcdd4d
@tompng
tompng deleted the rubygems_hook_accessors branch December 16, 2024 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gem rdoc gem_name fails with undefined method 'force=' for an instance of RDoc::RubygemsHook

2 participants