Module: Edit

Includes:
Operations
Included in:
Id
Defined in:
lib/edit.rb

Constant Summary

Constants included from Operations

Operations::Operand, Operations::Operator

Instance Method Summary collapse

Methods included from Operations

#process_operation, #process_operations

Instance Method Details

#edit(node, linearg = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/edit.rb', line 6

def edit node, linearg = nil
  @node = node
  @nodes[node] = [] if not @nodes[node]
  save
  while true
    header node
    if linearg
      line = linearg
    else
      line = readline
    end
    exit unless line
      if line == "#" 
        @msg = ""
        @raw = @raw.!
        if @raw
          @prompt = " # ".col 'blue'
        else
          @prompt = "<> ".col("cyan", "black")
        end

      elsif process_operations(line)
        msg ""
        edit node
      else
 
        @msg = ""
        save
        if line != ""
          if @nodes[node].find_index(line) and not @raw
              @path << node
              edit line
          else
            ins node, line
          end
        else
          back node
        end
      end
    save
    return if linearg
  end
end