Top Level Namespace

Defined Under Namespace

Modules: Ordinals Classes: InscriptionStats, RecursiveGenerator, RecursiveImage, RecursiveImageComposite

Constant Summary collapse

HEADER_RX =

note: key only supports a-z0-9 AND dash(-)

  no underscore(_) or dot(.)

follow HTTP headers and domain names format
/\A(?<key>[a-z][a-z0-9-]*)
    :
    [ ]*
  (?<value>.+?)    ## non-greedy
 \z
/x
RcsvImage =

add conveniecen shortcuts/alias - why? why not?

RecursiveImage
RcsvImageComposite =
RecursiveImageComposite

Instance Method Summary collapse

Instance Method Details

#nokogiriObject

note: add nokogiri for api (html parsing)



4
# File 'lib/ordinals.rb', line 4

require 'nokogiri'

#read_headers(path) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ordinals.rb', line 26

def read_headers( path )
  txt = read_text( path )
  h = {}
  txt.each_line do |line|
    line = line.strip
    ## skip empty and comment lines
    next if line.empty? || line.start_with?( '#' )

    if m=HEADER_RX.match(line)
      key   = m[:key]
      value = m[:value]
      
      h[key] = value
   else 
      puts "!! ERROR - parse error - no header pattern match for:"
      puts line
      exit 1
   end
  end
  h
end