Class: Polisher::RPM::Patch
- Inherits:
-
Object
- Object
- Polisher::RPM::Patch
- Defined in:
- lib/polisher/rpm/patch.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Patch
constructor
A new instance of Patch.
- #spec_line(n = 0) ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Patch
Returns a new instance of Patch.
12 13 14 15 |
# File 'lib/polisher/rpm/patch.rb', line 12 def initialize(args={}) @title = args[:title] @content = args[:content] end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
10 11 12 |
# File 'lib/polisher/rpm/patch.rb', line 10 def content @content end |
#title ⇒ Object
Returns the value of attribute title.
9 10 11 |
# File 'lib/polisher/rpm/patch.rb', line 9 def title @title end |
Class Method Details
.from(diff) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/polisher/rpm/patch.rb', line 21 def self.from(diff) return diff.collect { |d| self.from(d) } if diff.is_a?(Array) result = {} in_diff = nil diff.each_line do |line| if line =~ /diff -r ([^\s]+)+ ([^\s]+)+$/ result[in_diff] = diff if in_diff in_diff = $1.gsub(/a\//, '') diff = '' elsif line =~ /Only in.*$/ in_diff = nil else diff += line end end result.collect { |t,c| self.new :title => t, :content => c } end |
Instance Method Details
#spec_line(n = 0) ⇒ Object
17 18 19 |
# File 'lib/polisher/rpm/patch.rb', line 17 def spec_line(n=0) "Patch#{n}: #{title}" end |