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.
Class Method Summary collapse
- .create(array) ⇒ Object private
- .dump_for_formula(formula) ⇒ Object private
Instance Method Summary collapse
- #&(other) ⇒ Object private
- #*(other) ⇒ Object private
- #+(other) ⇒ Object private
- #-(other) ⇒ Object private
- #<<(other) ⇒ Object private
- #as_flags ⇒ Object private
- #each(*args, &block) ⇒ Object private
- #empty? ⇒ Boolean private
- #freeze ⇒ Object private
- #include?(option) ⇒ Boolean private
-
#initialize(*args) ⇒ Options
constructor
private
A new instance of Options.
- #initialize_dup(other) ⇒ Object private
-
#to_a ⇒ Array<Option>
private
This is a workaround to enable
alias to_ary to_a
. - #to_ary ⇒ Object private
- #|(other) ⇒ Object private
Methods included from Enumerable
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.
71 72 73 74 |
# File 'options.rb', line 71 def initialize(*args) # Ensure this is synced with `initialize_dup` and `freeze` (excluding simple objects like integers and booleans) @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.
67 68 69 |
# File 'options.rb', line 67 def self.create(array) new Array(array).map { |e| Option.new(e[/^--([^=]+=?)(.+)?$/, 1] || e) } end |
.dump_for_formula(formula) ⇒ 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.
145 146 147 148 149 150 |
# File 'options.rb', line 145 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) ⇒ 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.
103 104 105 |
# File 'options.rb', line 103 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.
111 112 113 |
# File 'options.rb', line 111 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.
95 96 97 |
# File 'options.rb', line 95 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.
99 100 101 |
# File 'options.rb', line 99 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.
90 91 92 93 |
# File 'options.rb', line 90 def <<(other) @options << other self end |
#as_flags ⇒ 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.
125 126 127 |
# File 'options.rb', line 125 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.
86 87 88 |
# File 'options.rb', line 86 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.
121 122 123 |
# File 'options.rb', line 121 def empty? @options.empty? end |
#freeze ⇒ 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.
81 82 83 84 |
# File 'options.rb', line 81 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.
129 130 131 |
# File 'options.rb', line 129 def include?(option) any? { |opt| opt == option || opt.name == option || opt.flag == option } end |
#initialize_dup(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.
76 77 78 79 |
# File 'options.rb', line 76 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.
133 |
# File 'options.rb', line 133 alias to_ary to_a |
#|(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.
107 108 109 |
# File 'options.rb', line 107 def |(other) self.class.new(@options | other) end |