Skip to content

Commit 160d42b

Browse files
committed
Nodoc some private functions/modules
1 parent 22cc8ca commit 160d42b

6 files changed

Lines changed: 22 additions & 22 deletions

File tree

lib/prism/parse_result.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def deep_freeze
163163

164164
# Binary search through the offsets to find the line number for the given
165165
# byte offset.
166-
def find_line(byte_offset)
166+
def find_line(byte_offset) # :nodoc:
167167
index = offsets.bsearch_index { |offset| offset > byte_offset } || offsets.length
168168
index - 1
169169
end

lib/prism/pattern.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,23 @@ def scan(root)
100100

101101
# Shortcut for combining two procs into one that returns true if both return
102102
# true.
103-
def combine_and(left, right)
103+
def combine_and(left, right) # :nodoc:
104104
->(other) { left.call(other) && right.call(other) }
105105
end
106106

107107
# Shortcut for combining two procs into one that returns true if either
108108
# returns true.
109-
def combine_or(left, right)
109+
def combine_or(left, right) # :nodoc:
110110
->(other) { left.call(other) || right.call(other) }
111111
end
112112

113113
# Raise an error because the given node is not supported.
114-
def compile_error(node)
114+
def compile_error(node) # :nodoc:
115115
raise CompilationError, node.inspect
116116
end
117117

118118
# in [foo, bar, baz]
119-
def compile_array_pattern_node(node)
119+
def compile_array_pattern_node(node) # :nodoc:
120120
compile_error(node) if !node.rest.nil? || node.posts.any?
121121

122122
constant = node.constant
@@ -141,12 +141,12 @@ def compile_array_pattern_node(node)
141141
end
142142

143143
# in foo | bar
144-
def compile_alternation_pattern_node(node)
144+
def compile_alternation_pattern_node(node) # :nodoc:
145145
combine_or(compile_node(node.left), compile_node(node.right))
146146
end
147147

148148
# in Prism::ConstantReadNode
149-
def compile_constant_path_node(node)
149+
def compile_constant_path_node(node) # :nodoc:
150150
parent = node.parent
151151

152152
if parent.is_a?(ConstantReadNode) && parent.slice == "Prism"
@@ -161,12 +161,12 @@ def compile_constant_path_node(node)
161161

162162
# in ConstantReadNode
163163
# in String
164-
def compile_constant_read_node(node)
164+
def compile_constant_read_node(node) # :nodoc:
165165
compile_constant_name(node, node.name)
166166
end
167167

168168
# Compile a name associated with a constant.
169-
def compile_constant_name(node, name)
169+
def compile_constant_name(node, name) # :nodoc:
170170
if Prism.const_defined?(name, false)
171171
clazz = Prism.const_get(name)
172172

@@ -182,7 +182,7 @@ def compile_constant_name(node, name)
182182

183183
# in InstanceVariableReadNode[name: Symbol]
184184
# in { name: Symbol }
185-
def compile_hash_pattern_node(node)
185+
def compile_hash_pattern_node(node) # :nodoc:
186186
compile_error(node) if node.rest
187187
compiled_constant = compile_node(node.constant) if node.constant
188188

@@ -212,36 +212,36 @@ def compile_hash_pattern_node(node)
212212
end
213213

214214
# in nil
215-
def compile_nil_node(node)
215+
def compile_nil_node(node) # :nodoc:
216216
->(attribute) { attribute.nil? }
217217
end
218218

219219
# in /foo/
220-
def compile_regular_expression_node(node)
220+
def compile_regular_expression_node(node) # :nodoc:
221221
regexp = Regexp.new(node.unescaped, node.closing[1..])
222222

223223
->(attribute) { regexp === attribute }
224224
end
225225

226226
# in ""
227227
# in "foo"
228-
def compile_string_node(node)
228+
def compile_string_node(node) # :nodoc:
229229
string = node.unescaped
230230

231231
->(attribute) { string === attribute }
232232
end
233233

234234
# in :+
235235
# in :foo
236-
def compile_symbol_node(node)
236+
def compile_symbol_node(node) # :nodoc:
237237
symbol = node.unescaped.to_sym
238238

239239
->(attribute) { symbol === attribute }
240240
end
241241

242242
# Compile any kind of node. Dispatch out to the individual compilation
243243
# methods based on the type of node.
244-
def compile_node(node)
244+
def compile_node(node) # :nodoc:
245245
case node
246246
when AlternationPatternNode
247247
compile_alternation_pattern_node(node)

templates/lib/prism/dispatcher.rb.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module Prism
5656
end
5757

5858
# Register a listener for the given events.
59-
private def register_events(listener, events)
59+
private def register_events(listener, events) # :nodoc:
6060
events.each { |event| (listeners[event] ||= []) << listener }
6161
end
6262

templates/lib/prism/dot_visitor.rb.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,19 @@ module Prism
165165
private
166166

167167
# Generate a unique node ID for a node throughout the digraph.
168-
def node_id(node)
168+
def node_id(node) # :nodoc:
169169
"Node_#{node.object_id}"
170170
end
171171

172172
# Inspect a location to display the start and end line and columns in bytes.
173-
def location_inspect(location)
173+
def location_inspect(location) # :nodoc:
174174
"(#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column})"
175175
end
176176
<%- flags.each do |flag| -%>
177177

178178
# Inspect a node that has <%= flag.human %> flags to display the flags as a
179179
# comma-separated list.
180-
def <%= flag.human %>_inspect(node)
180+
def <%= flag.human %>_inspect(node) # :nodoc:
181181
flags = [] #: Array[String]
182182
<%- flag.values.each do |value| -%>
183183
flags << "<%= value.name.downcase %>" if node.<%= value.name.downcase %>?

templates/lib/prism/inspect_visitor.rb.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ module Prism
114114
private
115115

116116
# Compose a header for the given node.
117-
def inspect_node(name, node)
117+
def inspect_node(name, node) # :nodoc:
118118
location = node.location
119119
"@ #{name} (location: (#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column}))\n"
120120
end
121121

122122
# Compose a string representing the given inner location field.
123-
def inspect_location(location)
123+
def inspect_location(location) # :nodoc:
124124
if location
125125
"(#{location.start_line},#{location.start_column})-(#{location.end_line},#{location.end_column}) = #{location.slice.inspect}"
126126
else

templates/lib/prism/serialize.rb.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require_relative "polyfill/unpack1"
33

44
module Prism
55
# A module responsible for deserializing parse results.
6-
module Serialize
6+
module Serialize # :nodoc:
77
# The major version of prism that we are expecting to find in the serialized
88
# strings.
99
MAJOR_VERSION = 1

0 commit comments

Comments
 (0)