Class: RTFM::Option
- Inherits:
-
Struct
- Object
- Struct
- RTFM::Option
- Defined in:
- lib/rtfm/option.rb
Instance Attribute Summary collapse
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
Instance Attribute Details
#desc ⇒ Object
Returns the value of attribute desc
2 3 4 |
# File 'lib/rtfm/option.rb', line 2 def desc @desc end |
#opts ⇒ Object
Returns the value of attribute opts
2 3 4 |
# File 'lib/rtfm/option.rb', line 2 def opts @opts end |
#title ⇒ Object
Returns the value of attribute title
2 3 4 |
# File 'lib/rtfm/option.rb', line 2 def title @title end |
Instance Method Details
#argument ⇒ Object
7 8 9 |
# File 'lib/rtfm/option.rb', line 7 def argument opts && (opts[:argument] || opts[:arg]) end |
#to_groff(how) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rtfm/option.rb', line 11 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 |