Method: RDoc::Parser::Ruby#get_visibility_information

Defined in:
lib/rdoc/parser/ruby.rb

#get_visibility_information(tk, single) ⇒ Object

Extracts the visibility information for the visibility token tk and single class type identifier.

Returns the visibility type (a string), the visibility (a symbol) and singleton if the methods following should be converted to singleton methods.



213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/rdoc/parser/ruby.rb', line 213

def get_visibility_information tk, single # :nodoc:
  vis_type  = tk[:text]
  singleton = single == SINGLE

  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

  return vis_type, vis, singleton
end