Skip to content

Commit

Permalink
[ruby/rdoc] [DOC] Add missing documents
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Dec 15, 2023
1 parent 578eb02 commit e15d690
Show file tree
Hide file tree
Showing 12 changed files with 63 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/rdoc.rb
Expand Up @@ -120,6 +120,17 @@ def self.load_yaml
end
end

##
# Seaches and returns the directory for settings.
#
# 1. <tt>$HOME/.rdoc</tt> directory, if it exists.
# 2. The +rdoc+ directory under the path specified by the
# +XDG_DATA_HOME+ environment variable, if it is set.
# 3. <tt>$HOME/.local/share/rdoc</tt> directory.
#
# Other than the home directory, the containing directory will be
# created automatically.

def self.home
rdoc_dir = begin
File.expand_path('~/.rdoc')
Expand Down
3 changes: 3 additions & 0 deletions lib/rdoc/cross_reference.rb
Expand Up @@ -131,6 +131,9 @@ def initialize context
@seen = {}
end

##
# Returns a method reference to +name+.

def resolve_method name
ref = nil

Expand Down
1 change: 0 additions & 1 deletion lib/rdoc/markdown/literals.rb
Expand Up @@ -3,7 +3,6 @@
# :markup: markdown

##
#--
# This set of literals is for Ruby 1.9 regular expressions and gives full
# unicode support.
#
Expand Down
10 changes: 9 additions & 1 deletion lib/rdoc/markup/table.rb
Expand Up @@ -3,8 +3,16 @@
# A section of table

class RDoc::Markup::Table
attr_accessor :header, :align, :body
# headers of each column
attr_accessor :header

# alignments of each column
attr_accessor :align

# body texts of each column
attr_accessor :body

# Creates new instance
def initialize header, align, body
@header, @align, @body = header, align, body
end
Expand Down
3 changes: 3 additions & 0 deletions lib/rdoc/markup/to_html_snippet.rb
Expand Up @@ -66,6 +66,9 @@ def accept_heading heading

alias accept_rule ignore

##
# Adds +paragraph+ to the output

def accept_paragraph paragraph
para = @in_list_entry.last || "<p>"

Expand Down
3 changes: 3 additions & 0 deletions lib/rdoc/parser/c.rb
Expand Up @@ -1215,6 +1215,9 @@ def scan
@top_level
end

##
# Creates a RDoc::Comment instance.

def new_comment text = nil, location = nil, language = nil
RDoc::Comment.new(text, location, language).tap do |comment|
comment.format = @markup
Expand Down
15 changes: 15 additions & 0 deletions lib/rdoc/parser/changelog.rb
Expand Up @@ -216,12 +216,22 @@ def scan
@top_level
end

##
# The extension for Git commit log

module Git
##
# Parses auxiliary info. Currentry `base-url` to expand
# references is effective.

def parse_info(info)
/^\s*base-url\s*=\s*(.*\S)/ =~ info
@base_url = $1
end

##
# Parses the entries in the Git commit logs

def parse_entries
entries = []

Expand All @@ -244,6 +254,11 @@ def parse_entries
entries
end

##
# Returns a list of ChangeLog entries as
# RDoc::Parser::ChangeLog::Git::LogEntry list for the given
# +entries+.

def create_entries entries
# git log entries have no strictly itemized style like the old
# style, just assume Markdown.
Expand Down
6 changes: 6 additions & 0 deletions lib/rdoc/parser/ripper_state_lex.rb
@@ -1,6 +1,9 @@
# frozen_string_literal: true
require 'ripper'

##
# Wrapper for Ripper lex states

class RDoc::Parser::RipperStateLex
# TODO: Remove this constants after Ruby 2.4 EOL
RIPPER_HAS_LEX_STATE = Ripper::Filter.method_defined?(:state)
Expand Down Expand Up @@ -565,13 +568,15 @@ def get_squashed_tk
tk
end

# New lexer for +code+.
def initialize(code)
@buf = []
@heredoc_queue = []
@inner_lex = InnerStateLex.new(code)
@tokens = @inner_lex.parse([])
end

# Returns tokens parsed from +code+.
def self.parse(code)
lex = self.new(code)
tokens = []
Expand All @@ -584,6 +589,7 @@ def self.parse(code)
tokens
end

# Returns +true+ if lex state will be +END+ after +token+.
def self.end?(token)
(token[:state] & EXPR_END)
end
Expand Down
3 changes: 3 additions & 0 deletions lib/rdoc/parser/ruby.rb
Expand Up @@ -180,6 +180,9 @@ def initialize(top_level, file_name, content, options, stats)
reset
end

##
# Return +true+ if +tk+ is a newline.

def tk_nl?(tk)
:on_nl == tk[:kind] or :on_ignored_nl == tk[:kind]
end
Expand Down
3 changes: 3 additions & 0 deletions lib/rdoc/store.rb
Expand Up @@ -197,6 +197,9 @@ def add_file absolute_name, relative_name: absolute_name, parser: nil
top_level
end

##
# Sets the parser of +absolute_name+, unless it from a source code file.

def update_parser_of_file(absolute_name, parser)
if top_level = @files_hash[absolute_name] then
@text_files_hash[absolute_name] = top_level if top_level.text?
Expand Down
4 changes: 4 additions & 0 deletions lib/rdoc/text.rb
Expand Up @@ -10,6 +10,10 @@

module RDoc::Text

##
# The language for this text. This affects stripping comments
# markers.

attr_accessor :language

##
Expand Down
3 changes: 3 additions & 0 deletions lib/rdoc/top_level.rb
Expand Up @@ -52,6 +52,9 @@ def initialize absolute_name, relative_name = absolute_name
@classes_or_modules = []
end

##
# Sets the parser for this toplevel context, also the store.

def parser=(val)
@parser = val
@store.update_parser_of_file(absolute_name, val) if @store
Expand Down

0 comments on commit e15d690

Please sign in to comment.