Class: DiffChanges

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
app/adapters/houston/adapters/version_control/git_adapter/diff_changes.rb

Instance Method Summary collapse

Constructor Details

#initialize(diff) ⇒ DiffChanges

Returns a new instance of DiffChanges.



38
39
40
# File 'app/adapters/houston/adapters/version_control/git_adapter/diff_changes.rb', line 38

def initialize(diff)
  super diff.to_s.scan(/^([^\t]+)\t(.*)$/).map { |(type, file)| DiffChange.new(type, file) }
end

Instance Method Details

#[](filename) ⇒ Object



46
47
48
# File 'app/adapters/houston/adapters/version_control/git_adapter/diff_changes.rb', line 46

def [](filename)
  __getobj__.detect { |change| change.file == filename }
end

#grep(regex) ⇒ Object



42
43
44
# File 'app/adapters/houston/adapters/version_control/git_adapter/diff_changes.rb', line 42

def grep(regex)
  __getobj__.select { |change| change.file =~ regex }
end