Class: Tb::Cmd::SVNLOGListener
- Inherits:
-
Object
- Object
- Tb::Cmd::SVNLOGListener
- Defined in:
- lib/tb/cmd_svn.rb
Instance Method Summary collapse
- #attlistdecl(element_name, attributes, raw_content) ⇒ Object
- #cdata(content) ⇒ Object
- #comment(comment) ⇒ Object
- #doctype(name, pub_sys, long_name, uri) ⇒ Object
- #doctype_end ⇒ Object
- #elementdecl(content) ⇒ Object
- #entity(content) ⇒ Object
- #entitydecl(content) ⇒ Object
-
#initialize(y) ⇒ SVNLOGListener
constructor
A new instance of SVNLOGListener.
- #instruction(name, instruction) ⇒ Object
- #notationdecl(content) ⇒ Object
- #tag_end(name) ⇒ Object
- #tag_start(name, attrs) ⇒ Object
- #text(text) ⇒ Object
- #xmldecl(version, encoding, standalone) ⇒ Object
Constructor Details
#initialize(y) ⇒ SVNLOGListener
Returns a new instance of SVNLOGListener.
55 56 57 58 59 60 61 |
# File 'lib/tb/cmd_svn.rb', line 55 def initialize(y) @y = y @header = nil @elt_stack = [] @att_stack = [] @log = nil end |
Instance Method Details
#attlistdecl(element_name, attributes, raw_content) ⇒ Object
137 138 |
# File 'lib/tb/cmd_svn.rb', line 137 def attlistdecl(element_name, attributes, raw_content) end |
#cdata(content) ⇒ Object
152 153 154 |
# File 'lib/tb/cmd_svn.rb', line 152 def cdata(content) # I guess svn doesn't use CDATA... end |
#comment(comment) ⇒ Object
128 129 |
# File 'lib/tb/cmd_svn.rb', line 128 def comment(comment) end |
#doctype(name, pub_sys, long_name, uri) ⇒ Object
131 132 |
# File 'lib/tb/cmd_svn.rb', line 131 def doctype(name, pub_sys, long_name, uri) end |
#doctype_end ⇒ Object
134 135 |
# File 'lib/tb/cmd_svn.rb', line 134 def doctype_end end |
#elementdecl(content) ⇒ Object
140 141 |
# File 'lib/tb/cmd_svn.rb', line 140 def elementdecl(content) end |
#entity(content) ⇒ Object
149 150 |
# File 'lib/tb/cmd_svn.rb', line 149 def entity(content) end |
#entitydecl(content) ⇒ Object
143 144 |
# File 'lib/tb/cmd_svn.rb', line 143 def entitydecl(content) end |
#instruction(name, instruction) ⇒ Object
125 126 |
# File 'lib/tb/cmd_svn.rb', line 125 def instruction(name, instruction) end |
#notationdecl(content) ⇒ Object
146 147 |
# File 'lib/tb/cmd_svn.rb', line 146 def notationdecl(content) end |
#tag_end(name) ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/tb/cmd_svn.rb', line 89 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 @y.set_header @header end assoc = @log.to_a.reject {|f, v| !%w[rev author date msg].include?(f) } if !assoc.assoc('author') assoc << ['author', '(no author)'] end if !assoc.assoc('date') assoc << ['date', '(no date)'] end if !assoc.assoc('msg') assoc << ['msg', ''] end if @log['paths'] @log['paths'].each {|h| assoc2 = assoc.dup assoc2.concat(h.to_a.reject {|f, v| !%w[kind action path].include?(f) }) @y.yield Hash[assoc2] } else @y.yield Hash[assoc] end @log = nil end @elt_stack.pop @att_stack.pop end |
#tag_start(name, attrs) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/tb/cmd_svn.rb', line 63 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
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/tb/cmd_svn.rb', line 76 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
156 157 |
# File 'lib/tb/cmd_svn.rb', line 156 def xmldecl(version, encoding, standalone) end |