class Depix::Binary::RdocGenerator

Generates a description of the structure in RDoc format

Constants

TPL

Attributes

attr_template[RW]
io[RW]
struct_template[RW]

Public Class Methods

new() click to toggle source
# File lib/depix/binary/rdoc_generator.rb, line 21
def initialize
  @padding =  '  '
  @attr_template = "%s* <tt>%s</tt> %s"
  @struct_template = "%s* <tt>%s</tt> %s:"
  @array_template  = "%s* <tt>%s</tt> %s:"
end

Public Instance Methods

explain_attr(padding, e) click to toggle source
# File lib/depix/binary/rdoc_generator.rb, line 56
def explain_attr(padding, e)
  type_name = e.rtype ? "(#{e.rtype})" : nil
  @io.puts( @attr_template % [padding, e.name, e.explain])
end
get_rdoc_for(struct) click to toggle source
# File lib/depix/binary/rdoc_generator.rb, line 28
def get_rdoc_for(struct)
  @io = StringIO.new
  explain_struct(struct)
  TPL % @io.string
end