Sha256: 0242e571b402fc8bb2dc70707ec10698a2e4ecfad5b6ffaf4837efecf7cf0450
Contents?: true
Size: 848 Bytes
Versions: 3
Compression:
Stored size: 848 Bytes
Contents
module RTFM class Option < Struct.new(:title, :desc, :opts) def title super.to_s end def argument opts && (opts[:argument] || opts[:arg]) end def to_groff(how) GroffString.groffify do |out| args = [:Fl, self.title] if self.argument argument = self.argument.to_s if argument[0,1] == "<" && argument[-1,1] == ">" args << "Ao" << argument[1..-2] << "Ac" elsif argument[0,1] == "[" && argument[-1,1] == "]" args << "Oo" << argument[1..-2] << "Oc" else args << :Ar << argument end end case how when :option out.Op *args when :item out.Pp out.It *args out << self.desc end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rtfm-0.5.2 | lib/rtfm/option.rb |
rtfm-0.5.1 | lib/rtfm/option.rb |
rtfm-0.5.0 | lib/rtfm/option.rb |