method
parse_visibility
v1_9_2_180 -
Show latest stable
- Class:
RDoc::Parser::Ruby
parse_visibility(container, single, tk)public
No documentation available.
# File lib/rdoc/parser/ruby.rb, line 1343
def parse_visibility(container, single, tk)
singleton = (single == SINGLE)
vis_type = tk.name
vis = case vis_type
when 'private' then :private
when 'protected' then :protected
when 'public' then :public
when 'private_class_method' then
singleton = true
:private
when 'public_class_method' then
singleton = true
:public
when 'module_function' then
singleton = true
:public
else
raise RDoc::Error, "Invalid visibility: #{tk.name}"
end
skip_tkspace_comment false
case peek_tk
# Ryan Davis suggested the extension to ignore modifiers, because he
# often writes
#
# protected unless $TESTING
#
when TkNL, TkUNLESS_MOD, TkIF_MOD, TkSEMICOLON then
container.ongoing_visibility = vis
else
if vis_type == 'module_function' then
args = parse_symbol_arg
container.set_visibility_for args, :private, false
module_functions = []
container.methods_matching args do |m|
s_m = m.dup
s_m.singleton = true if RDoc::AnyMethod === s_m
s_m.visibility = :public
module_functions << s_m
end
module_functions.each do |s_m|
case s_m
when RDoc::AnyMethod then
container.add_method s_m
when RDoc::Attr then
container.add_attribute s_m
end
end
else
args = parse_symbol_arg
container.set_visibility_for args, vis, singleton
end
end
end