Class: Svnlog2csv::LogEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/svnlog2csv/log_entry.rb

Overview

Una LogEntry corrisponde ad un commit. Un commit è caratterizzato da una data, un autore e una serie di azioni. Ogni azione è un hash con la struttura n, dove tipo_azione può essere A (add), M (modify), D (delete), e n è il numero di file aggiunti/modificati/cancellati.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ LogEntry

Returns a new instance of LogEntry.



12
13
14
15
16
17
18
19
20
# File 'lib/svnlog2csv/log_entry.rb', line 12

def initialize xml
  doc      = Nokogiri::XML(xml)
  @day     = doc.xpath("//date")[0].inner_text[0..9]
  @author  = doc.xpath("//author")[0].inner_text
  @actions = Hash.new(0)
  doc.xpath("//path").each do |path|
    @actions[path.attribute("action").value.to_sym] += 1
  end
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



10
11
12
# File 'lib/svnlog2csv/log_entry.rb', line 10

def actions
  @actions
end

#authorObject (readonly)

Returns the value of attribute author.



10
11
12
# File 'lib/svnlog2csv/log_entry.rb', line 10

def author
  @author
end

#dayObject (readonly)

Returns the value of attribute day.



10
11
12
# File 'lib/svnlog2csv/log_entry.rb', line 10

def day
  @day
end