Class: Array
- Defined in:
- lib/docgenerator/standard.rb,
lib/docgenerator/packages/struktex.rb
Overview
Extend Array class to build structogramms.
Instance Method Summary collapse
-
#to_doc(target, options = {}) ⇒ Object
Returns the element for each element in the list.
-
#to_structex ⇒ Object
Recursive extension for all structogramm elements.
Instance Method Details
#to_doc(target, options = {}) ⇒ Object
Returns the element for each element in the list.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/docgenerator/standard.rb', line 75 def to_doc(target, = {}) o = Docgenerator.set_option_defaults() o[:log].debug("enter to_doc(#{target}) for Array, options: #{.keys.inspect}") if o[:log].debug? str = "" self.each{|el| begin res = el.to_doc(target, o) rescue ArgumentError o[:log].fatal("ArgumentError to_doc for element <#{el.class}>") if o[:log].fatal? res = el.to_doc(target) end #Add text. If necessary, convert the encoding. begin str << res rescue Encoding::CompatibilityError str << res.encode(str.encoding) end } return str end |
#to_structex ⇒ Object
Recursive extension for all structogramm elements. So we can avoid a check, if the method is available.
20 21 22 23 24 25 26 27 28 |
# File 'lib/docgenerator/packages/struktex.rb', line 20 def to_structex return self.map{|e| if e.respond_to?( :to_structex ) e.to_structex else e end }.flatten end |