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.



16
17
18
# File 'lib/svnx/log/entry.rb', line 16

def author
  @author
end

#dateObject (readonly)

Returns the value of attribute date.



16
17
18
# File 'lib/svnx/log/entry.rb', line 16

def date
  @date
end

#msgObject (readonly)

Returns the value of attribute msg.



16
17
18
# File 'lib/svnx/log/entry.rb', line 16

def msg
  @msg
end

#pathsObject (readonly)

Returns the value of attribute paths.



16
17
18
# File 'lib/svnx/log/entry.rb', line 16

def paths
  @paths
end

#revisionObject (readonly)

Returns the value of attribute revision.



16
17
18
# File 'lib/svnx/log/entry.rb', line 16

def revision
  @revision
end

Instance Method Details

#datetimeObject



50
51
52
# File 'lib/svnx/log/entry.rb', line 50

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

#find_paths(args) ⇒ Object



54
55
56
57
58
59
60
# File 'lib/svnx/log/entry.rb', line 54

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

#match(action, filter) ⇒ Object



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

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

#messageObject



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

def message
  @msg
end

#set_from_element(elmt) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/svnx/log/entry.rb', line 18

def set_from_element elmt
  set_attr_var elmt, 'revision'
  set_elmt_vars elmt, 'author', 'date', 'msg'
  
  @paths = Array.new

  elmt.elements.each('paths/path') do |pe|
    kind = attribute_value pe, 'kind'
    action = attribute_value pe, 'action'
    name = pe.text

    @paths << EntryPath.new(kind: kind, action: Svnx::Action.new(action), name: name)
  end
  
  # Svn isn't consistent with the order of paths
  @paths.sort!
end

#to_sObject



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

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