Module: Patch Private

Defined in:
patch.rb

Overview

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Helper module for creating patches.

Class Method Summary collapse

Class Method Details

.create(strip, src, &block) ⇒ Object

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'patch.rb', line 9

def self.create(strip, src, &block)
  case strip
  when :DATA
    DATAPatch.new(:p1)
  when String
    StringPatch.new(:p1, strip)
  when Symbol
    case src
    when :DATA
      DATAPatch.new(strip)
    when String
      StringPatch.new(strip, src)
    else
      ExternalPatch.new(strip, &block)
    end
  when nil
    raise ArgumentError, "nil value for strip"
  else
    raise ArgumentError, "Unexpected value #{strip.inspect} for strip"
  end
end