Class: QED::QuickParser

Inherits:
Object show all
Defined in:
lib/qed/qparser.rb

Overview

Expiremntal quick parser.

NOT USED YET!

Instance Method Summary collapse

Constructor Details

#initialize(demo) ⇒ QuickParser

Returns a new instance of QuickParser.


10
11
12
# File 'lib/qed/qparser.rb', line 10

def initialize(demo)
  @lines = demo.lines
end

Instance Method Details

#parseObject


15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/qed/qparser.rb', line 15

def parse
  flush  = true
  script = []

  @lines.each do |line|
    case line
    when /^\s/
      if flush
        script << "Test do\n"
      end
      script << line
      flush = false
    else
      if !flush
        script << "end"
      end
      script << "# " + line
      flush = true
    end
  end

  script.join()
end