Method: RDoc::Generator::Shomen#generate_methods
- Defined in:
- lib/shomen/rdoc.rb
#generate_methods ⇒ Object (protected)
Transform RDoc methods to Shomen model and add to table.
TODO: How to get literal interface separate from call-sequnces?
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/shomen/rdoc.rb', line 244 def generate_methods debug_msg "Generating method documentation:" list = methods_all + attributes_all list.each do |rdoc_method| #debug_msg "%s" % [rdoc_method.full_name] #full_name = method_name(m) #'prettyname' => m.pretty_name, #'type' => m.type, # class or instance model = Shomen::Model::Method.new model.path = method_name(rdoc_method) model.name = rdoc_method.name model.namespace = rdoc_method.parent_name model.comment = rdoc_method.comment model.format = 'rdoc' model.aliases = rdoc_method.aliases.map{ |a| method_name(a) } model.alias_for = method_name(rdoc_method.is_alias_for) model.singleton = rdoc_method.singleton model.declarations << rdoc_method.type.to_s #singleton ? 'class' : 'instance' model.declarations << rdoc_method.visibility.to_s model.interfaces = [] if rdoc_method.call_seq rdoc_method.call_seq.split("\n").each do |cs| cs = cs.to_s.strip model.interfaces << parse_interface(cs) unless cs == '' end end model.interfaces << parse_interface("#{rdoc_method.name}#{rdoc_method.params}") model.returns = [] # RDoc doesn't support specifying return values model.file = '/'+rdoc_method.source_code_location.first model.line = rdoc_method.source_code_location.last.to_i model.source = rdoc_method.source_code_raw if rdoc_method.respond_to?(:c_function) model.language = rdoc_method.c_function ? 'c' : 'ruby' else model.language = 'ruby' end @table[model.path] = model.to_h end end |