Class: PodSections
- Inherits:
-
AbstractIndex
- Object
- AbstractIndex
- PodSections
- Defined in:
- lib/langhelp/lh_perl.rb
Constant Summary
Constants inherited from AbstractIndex
Constants included from LocalVariables
LocalVariables::ANCHOR_BEGIN, LocalVariables::ANCHOR_END
Constants included from KanjiConverter
Instance Attribute Summary
Attributes inherited from AbstractIndex
Instance Method Summary collapse
Methods inherited from AbstractIndex
Methods included from LocalVariables
Methods included from FilenameString
#abbreviate_filename, #abbreviate_filename!, #normalize_filename!
Methods included from KanjiConverter
Methods included from MkArray
Methods included from EmacsLispString
Constructor Details
This class inherits a constructor from AbstractIndex
Instance Method Details
#init(x = {}) ⇒ Object
22 23 24 25 |
# File 'lib/langhelp/lh_perl.rb', line 22 def init(x={}) @perl_pod = x[:perl_pod] normalize_filename! @perl_pod end |
#process_pod(pod_source) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/langhelp/lh_perl.rb', line 27 def process_pod(pod_source) @sections = [] heads = {} head_order = [] head = nil pod_source.split(/\n/).each do |line| case line when /^=head\d (.+)$/ head = $1 heads[head] = [] head_order << head when /^\s+(perl\w+)\t+(.+)$/ heads[head] << [$1, $2] end end head_order.each do |head| heads[head].each do |pod, desc| #printf "%-20s %s\n", pod, desc @sections << [head, pod, desc] end end end |