module CsvHuman::DocHelper
Constants
- ATTRIBUTE_LINE_RX
note: attrib might be one letter only (e.g.) +m,+f, etc.
- HASHTAG_LINE_RX
- HEADING_LINE_RX
e.g. 1.1. Places
2.1. Sex- and-age disaggregation (SADD) attributes
- SINCE_HXL_RX
- TYPE_RX
Public Instance Methods
match_attribute( line )
click to toggle source
# File lib/csvhuman/doc/helper.rb, line 33 def match_attribute( line ) if (m=ATTRIBUTE_LINE_RX.match(line)) puts "attrib >#{m[:name]}<" m else false end end
match_hashtag( line )
click to toggle source
# File lib/csvhuman/doc/helper.rb, line 14 def match_hashtag( line ) if (m=HASHTAG_LINE_RX.match(line)) puts "hashtag >#{m[:name]}<" m else nil end end
match_heading( line )
click to toggle source
# File lib/csvhuman/doc/helper.rb, line 59 def match_heading( line ) if (m=HEADING_LINE_RX.match(line)) puts "heading #{m[:level1]}.#{m[:level2]}. (#{m[:level2]}) >#{m[:title]}<" m else false end end
match_since_hxl( line )
click to toggle source
# File lib/csvhuman/doc/helper.rb, line 83 def match_since_hxl( line ) if (m=SINCE_HXL_RX.match(line)) puts "version: >#{m[:version]}<" m else false end end
match_type( line )
click to toggle source
# File lib/csvhuman/doc/helper.rb, line 71 def match_type( line ) if (m=TYPE_RX.match(line)) puts "type: >#{m[:type]}<" m else false end end
split_descr( line )
click to toggle source
# File lib/csvhuman/doc/helper.rb, line 94 def split_descr( line ) if( m=match_since_hxl( line )) version = m[:version] ## remove "Since HXL 1.0" from text text = line.gsub( SINCE_HXL_RX, '' ).strip else version = '?' text = line end [text,version] end