Class: Options Private
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.
Constant Summary collapse
- Elem =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
type_member(:out) { { fixed: Option } }
Class Method Summary collapse
- .create(array) ⇒ Options private
- .dump_for_formula(formula) ⇒ void private
Instance Method Summary collapse
- #&(other) ⇒ T.self_type private
- #*(other) ⇒ String private
- #+(other) ⇒ T.self_type private
- #-(other) ⇒ T.self_type private
- #<<(other) ⇒ T.self_type private
- #as_flags ⇒ Array<String> private
- #each(&block) ⇒ T.self_type private
- #empty? ⇒ Boolean private
- #freeze ⇒ T.self_type private
- #include?(option) ⇒ Boolean private
- #initialize(options = nil) ⇒ void constructor private
- #initialize_dup(other) ⇒ void private
-
#to_a ⇒ Array<Option>
private
This is a workaround to enable
alias to_ary to_a. - #to_ary ⇒ Object private
- #|(other) ⇒ T.self_type private
Methods included from Enumerable
Constructor Details
#initialize(options = nil) ⇒ void
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.
98 99 100 101 |
# File 'options.rb', line 98 def initialize( = nil) # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @options = T.let(Set.new(), T::Set[Option]) end |
Class Method Details
.create(array) ⇒ 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.
93 94 95 |
# File 'options.rb', line 93 def self.create(array) new Array(array).map { |e| Option.new(e[/^--([^=]+=?)(.+)?$/, 1] || e) } end |
.dump_for_formula(formula) ⇒ void
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.
This method returns an undefined value.
191 192 193 194 195 196 |
# File 'options.rb', line 191 def self.dump_for_formula(formula) formula..sort_by(&:flag).each do |opt| puts "#{opt.flag}\n\t#{opt.description}" end puts "--HEAD\n\tInstall HEAD version" if formula.head end |
Instance Method Details
#&(other) ⇒ T.self_type
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.
138 139 140 |
# File 'options.rb', line 138 def &(other) self.class.new(@options & other) end |
#*(other) ⇒ String
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.
148 149 150 |
# File 'options.rb', line 148 def *(other) @options.to_a * other end |
#+(other) ⇒ T.self_type
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.
128 129 130 |
# File 'options.rb', line 128 def +(other) self.class.new(@options + other) end |
#-(other) ⇒ T.self_type
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.
133 134 135 |
# File 'options.rb', line 133 def -(other) self.class.new(@options - other) end |
#<<(other) ⇒ T.self_type
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.
122 123 124 125 |
# File 'options.rb', line 122 def <<(other) @options << other self end |
#as_flags ⇒ Array<String>
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.
169 170 171 |
# File 'options.rb', line 169 def as_flags map(&:flag) end |
#each(&block) ⇒ T.self_type
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.
116 117 118 119 |
# File 'options.rb', line 116 def each(&block) @options.each(&block) self 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.
164 165 166 |
# File 'options.rb', line 164 def empty? @options.empty? end |
#freeze ⇒ T.self_type
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.
110 111 112 113 |
# File 'options.rb', line 110 def freeze @options.dup super end |
#include?(option) ⇒ 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.
174 175 176 |
# File 'options.rb', line 174 def include?(option) any? { |opt| opt == option || opt.name == option || opt.flag == option } end |
#initialize_dup(other) ⇒ void
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.
This method returns an undefined value.
104 105 106 107 |
# File 'options.rb', line 104 def initialize_dup(other) super @options = @options.dup end |
#to_a ⇒ Array<Option>
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.
This is a workaround to enable alias to_ary to_a
7 |
# File 'options.rbi', line 7 def to_a; end |
#to_ary ⇒ 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.
178 |
# File 'options.rb', line 178 alias to_ary to_a |
#|(other) ⇒ T.self_type
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.
143 144 145 |
# File 'options.rb', line 143 def |(other) self.class.new(@options | other) end |