Class: Tb::Cmd::SVNLOGListener

Inherits:
Object
  • Object
show all
Defined in:
lib/tb/cmd_svn_log.rb

Instance Method Summary collapse

Constructor Details

#initialize(gen) ⇒ SVNLOGListener

Returns a new instance of SVNLOGListener.



42
43
44
45
46
47
48
# File 'lib/tb/cmd_svn_log.rb', line 42

def initialize(gen)
  @gen = gen
  @header = nil
  @elt_stack = []
  @att_stack = []
  @log = nil
end

Instance Method Details

#attlistdecl(element_name, attributes, raw_content) ⇒ Object



112
113
# File 'lib/tb/cmd_svn_log.rb', line 112

def attlistdecl(element_name, attributes, raw_content)
end

#cdata(content) ⇒ Object



127
128
129
# File 'lib/tb/cmd_svn_log.rb', line 127

def cdata(content)
  # I guess svn doesn't use CDATA...
end

#comment(comment) ⇒ Object



103
104
# File 'lib/tb/cmd_svn_log.rb', line 103

def comment(comment)
end

#doctype(name, pub_sys, long_name, uri) ⇒ Object



106
107
# File 'lib/tb/cmd_svn_log.rb', line 106

def doctype(name, pub_sys, long_name, uri)
end

#doctype_endObject



109
110
# File 'lib/tb/cmd_svn_log.rb', line 109

def doctype_end
end

#elementdecl(content) ⇒ Object



115
116
# File 'lib/tb/cmd_svn_log.rb', line 115

def elementdecl(content)
end

#entity(content) ⇒ Object



124
125
# File 'lib/tb/cmd_svn_log.rb', line 124

def entity(content)
end

#entitydecl(content) ⇒ Object



118
119
# File 'lib/tb/cmd_svn_log.rb', line 118

def entitydecl(content)
end

#instruction(name, instruction) ⇒ Object



100
101
# File 'lib/tb/cmd_svn_log.rb', line 100

def instruction(name, instruction)
end

#notationdecl(content) ⇒ Object



121
122
# File 'lib/tb/cmd_svn_log.rb', line 121

def notationdecl(content)
end

#tag_end(name) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/tb/cmd_svn_log.rb', line 76

def tag_end(name)
  case @elt_stack
  when %w[log logentry]
    if !@header
      if @log['paths']
        @header = %w[rev author date msg kind action path]
      else
        @header = %w[rev author date msg]
      end
      @gen.output_header @header
    end
    if @log['paths']
      @log['paths'].each {|h|
        @gen << (@log.values_at(*%w[rev author date msg]) + h.values_at(*%w[kind action path]))
      }
    else
      @gen << @log.values_at(*%w[rev author date msg])
    end
    @log = nil
  end
  @elt_stack.pop
  @att_stack.pop
end

#tag_start(name, attrs) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/tb/cmd_svn_log.rb', line 50

def tag_start(name, attrs)
  @elt_stack.push name
  @att_stack.push attrs
  case @elt_stack
  when %w[log logentry]
    @log = { 'rev' => attrs['revision'] }
  when %w[log logentry paths]
    @log['paths'] = []
  when %w[log logentry paths path]
    @log['paths'] << { 'kind' => attrs['kind'], 'action' => attrs['action'] }
  end
end

#text(text) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/tb/cmd_svn_log.rb', line 63

def text(text)
  case @elt_stack
  when %w[log logentry author]
    @log['author'] = text
  when %w[log logentry date]
    @log['date'] = text
  when %w[log logentry paths path]
    @log['paths'].last['path'] = text
  when %w[log logentry msg]
    @log['msg'] = text
  end
end

#xmldecl(version, encoding, standalone) ⇒ Object



131
132
# File 'lib/tb/cmd_svn_log.rb', line 131

def xmldecl(version, encoding, standalone)
end