Class: Lazylead::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/task/svn/grep.rb

Overview

Single SVN commit details

Instance Method Summary collapse

Constructor Details

#initialize(commit) ⇒ Entry

Returns a new instance of Entry.



72
73
74
# File 'lib/lazylead/task/svn/grep.rb', line 72

def initialize(commit)
  @commit = commit
end

Instance Method Details

#authorObject



84
85
86
# File 'lib/lazylead/task/svn/grep.rb', line 84

def author
  header[1]
end

#headerObject



107
108
109
# File 'lib/lazylead/task/svn/grep.rb', line 107

def header
  @header ||= lines.first.split(" | ").reject(&:blank?)
end

#includes?(text) ⇒ Boolean

The modified lines contains expected text

Returns:

  • (Boolean)


97
98
99
100
101
# File 'lib/lazylead/task/svn/grep.rb', line 97

def includes?(text)
  text = [text] unless text.respond_to? :each
  lines[4..-1].select { |l| l.start_with? "+" }
              .any? { |l| text.any? { |t| l.include? t } }
end

#linesObject



103
104
105
# File 'lib/lazylead/task/svn/grep.rb', line 103

def lines
  @lines ||= @commit.split("\n").reject(&:blank?)
end

#msgObject



92
93
94
# File 'lib/lazylead/task/svn/grep.rb', line 92

def msg
  lines[1]
end

#revObject



80
81
82
# File 'lib/lazylead/task/svn/grep.rb', line 80

def rev
  header.first
end

#timeObject



88
89
90
# File 'lib/lazylead/task/svn/grep.rb', line 88

def time
  header[2]
end

#to_sObject



76
77
78
# File 'lib/lazylead/task/svn/grep.rb', line 76

def to_s
  "#{rev} #{msg}"
end