Class: Options Private

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
Enumerable
Defined in:
options.rb

Overview

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

A collection of formula options.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Options

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.

Returns a new instance of Options.



84
85
86
# File 'options.rb', line 84

def initialize(*args)
  @options = Set.new(*args)
end

Class Method Details

.create(array) ⇒ 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.



80
81
82
# File 'options.rb', line 80

def self.create(array)
  new Array(array).map { |e| Option.new(e[/^--([^=]+=?)(.+)?$/, 1] || e) }
end

.dump_for_formula(f) ⇒ 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.



142
143
144
145
146
147
# File 'options.rb', line 142

def self.dump_for_formula(f)
  f.options.sort_by(&:flag).each do |opt|
    puts "#{opt.flag}\n\t#{opt.description}"
  end
  puts "--HEAD\n\tInstall HEAD version" if f.head
end

Instance Method Details

#&(other) ⇒ 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.



105
106
107
# File 'options.rb', line 105

def &(other)
  self.class.new(@options & other)
end

#*(other) ⇒ 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.



113
114
115
# File 'options.rb', line 113

def *(other)
  @options.to_a * other
end

#+(other) ⇒ 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.



97
98
99
# File 'options.rb', line 97

def +(other)
  self.class.new(@options + other)
end

#-(other) ⇒ 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.



101
102
103
# File 'options.rb', line 101

def -(other)
  self.class.new(@options - other)
end

#<<(other) ⇒ 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.



92
93
94
95
# File 'options.rb', line 92

def <<(other)
  @options << other
  self
end

#==(other) ⇒ Object Also known as: eql?

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.



117
118
119
120
# File 'options.rb', line 117

def ==(other)
  instance_of?(other.class) &&
    to_a == other.to_a
end

#as_flagsObject

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.



127
128
129
# File 'options.rb', line 127

def as_flags
  map(&:flag)
end

#each(*args, &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.



88
89
90
# File 'options.rb', line 88

def each(*args, &block)
  @options.each(*args, &block)
end

#empty?Boolean

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.

Returns:

  • (Boolean)


123
124
125
# File 'options.rb', line 123

def empty?
  @options.empty?
end

#include?(o) ⇒ Boolean

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.

Returns:

  • (Boolean)


131
132
133
# File 'options.rb', line 131

def include?(o)
  any? { |opt| opt == o || opt.name == o || opt.flag == o }
end

#inspectString

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.

Returns:



138
139
140
# File 'options.rb', line 138

def inspect
  "#<#{self.class.name}: #{to_a.inspect}>"
end

#|(other) ⇒ 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.



109
110
111
# File 'options.rb', line 109

def |(other)
  self.class.new(@options | other)
end