class Gem2Rpm::RpmDependencyList

Public Class Methods

new(dependencies) click to toggle source
# File lib/gem2rpm/rpm_dependency_list.rb, line 7
def initialize(dependencies)
  @items = dependencies.map { |r| RpmDependency.new(r) }
end

Public Instance Methods

comment_out() click to toggle source

Comment out the dependency.

# File lib/gem2rpm/rpm_dependency_list.rb, line 46
def comment_out
  dep_list = self.map(&:comment_out)

  self.class.new dep_list
end
each() { |item| ... } click to toggle source

Calls the given block once for each element in self, passing that element as a parameter. Returns the array itself. If no block is given, an Enumerator is returned.

# File lib/gem2rpm/rpm_dependency_list.rb, line 14
def each
  # Return Enumerator when called withoug block.
  return to_enum(__callee__) unless block_given?

  @items.each { |item| yield item }
end
reject() { |item| ... } click to toggle source

Returns a new array containing the items in self for which the given block is not true. The ordering of non-rejected elements is maintained. If no block is given, an Enumerator is returned instead.

# File lib/gem2rpm/rpm_dependency_list.rb, line 24
def reject
  # Return Enumerator when called withoug block.
  return to_enum(__callee__) unless block_given?

  self.class.new(@items.reject { |item| yield item })
end
to_rpm() click to toggle source

Returns string with all dependencies from the list converted into entries suitable for RPM .spec file. Thise entries should include all necessary macros depending on file categorization.

# File lib/gem2rpm/rpm_dependency_list.rb, line 55
def to_rpm
  s = entries.map(&:to_rpm).join("\n")
  s += "\n" unless s.empty?
end
virtualize() click to toggle source

Convert to rubygem() virtual provide dependencies.

# File lib/gem2rpm/rpm_dependency_list.rb, line 32
def virtualize
  dep_list = self.map(&:virtualize)

  self.class.new dep_list
end
with_requires() click to toggle source

Output dependencies with RPM requires tag.

# File lib/gem2rpm/rpm_dependency_list.rb, line 39
def with_requires
  dep_list = self.map(&:with_requires)

  self.class.new dep_list
end