class WsdlMapper::Generation::YardDocFormatter
Public Class Methods
new(formatter)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 4 def initialize(formatter) @formatter = formatter @i = 0 end
Public Instance Methods
attribute!(name, type, doc, &block)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 65 def attribute!(name, type, doc, &block) tag '!attribute', name inc_indent text doc if doc type_tag 'return', type block.call if block_given? dec_indent end
blank_line()
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 50 def blank_line @formatter.blank_comment self end
class_doc(type)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 27 def class_doc(type) if type.documentation.present? text type.documentation.default blank_line end return unless type.name tag :xml_name, type.name.name if type.name.ns tag :xml_namespace, type.name.ns end end
dec_indent()
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 22 def dec_indent @i -= 1 self end
inc_indent()
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 17 def inc_indent @i += 1 self end
line(line)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 9 def line(line) buf = '# ' buf << ' ' * @i buf << strip(line) @formatter.statement buf self end
option(param_name, type, name, text = nil)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 74 def option(param_name, type, name, text = nil) buf = "@option #{param_name} [#{type}] :#{name}" buf << " #{text}" if text line buf end
param(name, type, text = nil)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 80 def param(name, type, text = nil) buf = "@param #{name} [#{type}]" buf << " #{text}" if text line buf end
params(*params)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 86 def params(*params) return if params.empty? params.each do |p| param(*p) end blank_line end
tag(tag, text)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 55 def tag(tag, text) line "@#{tag} #{text}" end
text(text)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 41 def text(text) lines = process(text).strip.split("\n") lines.each do |l| line l end self end
type_tag(tag_name, type, text = nil)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 59 def type_tag(tag_name, type, text = nil) buf = "@#{tag_name} [#{type}]" buf << " #{text}" if text line buf end
Protected Instance Methods
process(doc)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 100 def process(doc) doc end
strip(text)
click to toggle source
# File lib/wsdl_mapper/generation/yard_doc_formatter.rb, line 95 def strip(text) return '' if text.nil? text.gsub(/[\n\r]/, ' ').gsub(/\s+/, ' ').strip end