lib/rsync/result.rb in rsync-0.0.2 vs lib/rsync/result.rb in rsync-0.0.3

- old
+ new

@@ -8,19 +8,19 @@ @raw = raw @exitcode = exitcode end # Whether the rsync job was run without errors. - # @return Boolean + # @return {Boolean} def success? @exitcode.to_i == 0 end # The error message based on exit code. - # @return String + # @return {String} def error - case @exitcode.exitstatus + case @exitcode.to_i when 0 "Success" when 1 "Syntax or usage error" when 2 @@ -66,13 +66,19 @@ # List of changes made during this run. # # @return {Array<Change>} def changes + change_list + end + +private + + def change_list list = [] @raw.split("\n").each do |line| #if line =~ /^([<>ch.*][fdLDS][ .+\?cstTpoguax]{9}) (.*)$/ - if line =~ /^([<>ch.\*].{10}) (.*)$/ + if line =~ /^([<>ch\.\*].{10}) (.*)$/ detail = Change.new(line) list << detail if detail.changed? end end list