Class: Requirements

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

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Requirements

Returns a new instance of Requirements



38
39
40
# File 'brew/Library/Homebrew/dependencies.rb', line 38

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

Instance Method Details

#<<(other) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
# File 'brew/Library/Homebrew/dependencies.rb', line 42

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



54
55
56
# File 'brew/Library/Homebrew/dependencies.rb', line 54

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