class BatchRename::Editor::Result

Attributes

catalogs[R]

Public Class Methods

new(catalogs) click to toggle source
# File lib/batch_rename/editor/result.rb, line 29
def initialize(catalogs)
  @catalogs = catalogs
end

Public Instance Methods

modified_count() click to toggle source
# File lib/batch_rename/editor/result.rb, line 11
def modified_count
  modified_pairs.length
end
modified_pairs() click to toggle source
# File lib/batch_rename/editor/result.rb, line 19
def modified_pairs
  @modified_pairs ||= pairs.select { |a| a.reduce(&:!=) }
end
pairs() click to toggle source
# File lib/batch_rename/editor/result.rb, line 15
def pairs
  @pairs = lines.reduce(&:zip)
end
to_s() click to toggle source
# File lib/batch_rename/editor/result.rb, line 23
def to_s
  pairs.to_s
end
total_count() click to toggle source
# File lib/batch_rename/editor/result.rb, line 7
def total_count
  pairs.length
end

Private Instance Methods

lines() click to toggle source
# File lib/batch_rename/editor/result.rb, line 33
def lines
  @lines ||= catalogs.map do |catalog|
    File.open(catalog.file_name).each.map(&:chop)
  end
end