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.
17 18 19 20 |
# File 'options/options.rb', line 17 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.
12 13 14 |
# File 'options/options.rb', line 12 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.
110 111 112 113 114 115 |
# File 'options/options.rb', line 110 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.
57 58 59 |
# File 'options/options.rb', line 57 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.
67 68 69 |
# File 'options/options.rb', line 67 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.
47 48 49 |
# File 'options/options.rb', line 47 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.
52 53 54 |
# File 'options/options.rb', line 52 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.
41 42 43 44 |
# File 'options/options.rb', line 41 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.
88 89 90 |
# File 'options/options.rb', line 88 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.
35 36 37 38 |
# File 'options/options.rb', line 35 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.
83 84 85 |
# File 'options/options.rb', line 83 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.
29 30 31 32 |
# File 'options/options.rb', line 29 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.
93 94 95 |
# File 'options/options.rb', line 93 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.
23 24 25 26 |
# File 'options/options.rb', line 23 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.
97 |
# File 'options/options.rb', line 97 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.
62 63 64 |
# File 'options/options.rb', line 62 def |(other) self.class.new(@options | other) end |