Class: Requirements

Inherits:
Set
  • Object
show all
Defined in:
Library/Homebrew/dependencies.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Requirements

Returns a new instance of Requirements



36
37
38
# File 'Library/Homebrew/dependencies.rb', line 36

def initialize(*args)
  super(Set.new(args))
end

Instance Method Details

#<<(other) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'Library/Homebrew/dependencies.rb', line 40

def <<(other)
  if other.is_a?(Comparable)
    grep(other.class) do |req|
      return self if req > other
      delete(req)
    end
  end
  super
  self
end

#inspectObject



51
52
53
# File 'Library/Homebrew/dependencies.rb', line 51

def inspect
  "#<#{self.class.name}: {#{to_a.join(", ")}}>"
end