Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions lib/rdoc/markup/hard_break.rb
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
# frozen_string_literal: true
##
# A hard-break in the middle of a paragraph.

class RDoc::Markup::HardBreak

@instance = new

##
# RDoc::Markup::HardBreak is a singleton

def self.new
@instance
end

##
# Calls #accept_hard_break on +visitor+

def accept(visitor)
visitor.accept_hard_break self
module RDoc
class Markup
# A hard-break in the middle of a paragraph.
class HardBreak < Element
@instance = new

# RDoc::Markup::HardBreak is a singleton
#: () -> HardBreak
def self.new
@instance
end

# Calls #accept_hard_break on +visitor+
# @override
#: (untyped) -> void
def accept(visitor)
visitor.accept_hard_break(self)
end

#: (top) -> bool
def ==(other) # :nodoc:
self.class === other
end

# @override
Copy link
Member

Choose a reason for hiding this comment

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

I think this is Sorbet-specific RBS annotation. Do you know if RBS will officially adopt it or a similar syntax?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, indeed. The RBS ecosystem doesn't have support for abstract/override yet. I assume support will be added at some point, but I'm not sure about the syntax.

For now, since we're not running a type checker on the codebase, these are more documentation than actual type annotations.

Copy link
Member

Choose a reason for hiding this comment

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

I see. I'm a bit worried that this could confuse other maintainers/contributors that are now familiar with Ruby's typing development. Do you mind mentioning we're using Sorbet flavored RBS purely for documentation in CONTRIBUTING.md and AGENTS.md?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I'll open a separate PR to update it.

#: (PP) -> void
def pretty_print(q) # :nodoc:
q.text("[break]")
end
end
end

def ==(other) # :nodoc:
self.class === other
end

def pretty_print(q) # :nodoc:
q.text "[break]"
end

end
Loading