Class: Svnx::Log::Entry

Inherits:
Base::Entry show all
Defined in:
lib/svnx/log/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base::Entry

#attribute_value, #element_text, #initialize, #set_attr_var, #set_attr_vars, #set_elmt_var, #set_elmt_vars, #set_var

Constructor Details

This class inherits a constructor from Svnx::Base::Entry

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def author
  @author
end

#dateObject (readonly)

Returns the value of attribute date.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def date
  @date
end

#entriesObject (readonly)

Returns the value of attribute entries.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def entries
  @entries
end

#msgObject (readonly)

Returns the value of attribute msg.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def msg
  @msg
end

#pathsObject (readonly)

Returns the value of attribute paths.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def paths
  @paths
end

#reverse_mergeObject (readonly)

Returns the value of attribute reverse_merge.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def reverse_merge
  @reverse_merge
end

#revisionObject (readonly)

Returns the value of attribute revision.



11
12
13
# File 'lib/svnx/log/entry.rb', line 11

def revision
  @revision
end

Instance Method Details

#datetimeObject



46
47
48
# File 'lib/svnx/log/entry.rb', line 46

def datetime
  @dt ||= DateTime.parse date
end

#find_paths(args) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/svnx/log/entry.rb', line 50

def find_paths args
  paths.select do |path|
    if args[:kind]
      path.kind == args[:kind]
    end
  end
end

#inspectObject



36
37
38
# File 'lib/svnx/log/entry.rb', line 36

def inspect
  to_s
end

#match(action, filter) ⇒ Object



40
41
42
43
44
# File 'lib/svnx/log/entry.rb', line 40

def match action, filter
  paths.select do |path|
    path.match? action, filter
  end
end

#messageObject



28
29
30
# File 'lib/svnx/log/entry.rb', line 28

def message
  @msg
end

#set_from_element(elmt) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/svnx/log/entry.rb', line 13

def set_from_element elmt
  set_attr_var elmt, 'revision', convert: :to_i
  @reverse_merge = attribute_value elmt, 'reverse-merge'
  
  set_elmt_vars elmt, 'author', 'date', 'msg'

  @paths = elmt.xpath('paths/path').collect do |pe|
    EntryPath.new attr: pe
  end.sort                  # sorted, because svn is not consistent with order

  @entries = elmt.xpath('logentry').collect do |le|
    Entry.new le
  end
end

#to_sObject



32
33
34
# File 'lib/svnx/log/entry.rb', line 32

def to_s
  [ @revision, @author, @date, @msg ].collect { |x| x.to_s }.join " "
end