Class: Options Private
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
-
.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
-
#==(other) ⇒ Object
(also: #eql?)
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
-
#inspect ⇒ String
private
-
#to_s ⇒ String
private
-
#|(other) ⇒ Object
private
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.
78 79 80 81 |
# File 'options.rb', line 78 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.
74 75 76 |
# File 'options.rb', line 74 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.
152 153 154 155 156 157 |
# File 'options.rb', line 152 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.
110 111 112 |
# File 'options.rb', line 110 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.
118 119 120 |
# File 'options.rb', line 118 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.
102 103 104 |
# File 'options.rb', line 102 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.
106 107 108 |
# File 'options.rb', line 106 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.
97 98 99 100 |
# File 'options.rb', line 97 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.
122 123 124 125 |
# File 'options.rb', line 122 def ==(other) instance_of?(other.class) && to_a == other.to_a 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.
132 133 134 |
# File 'options.rb', line 132 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.
93 94 95 |
# File 'options.rb', line 93 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.
128 129 130 |
# File 'options.rb', line 128 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.
88 89 90 91 |
# File 'options.rb', line 88 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.
136 137 138 |
# File 'options.rb', line 136 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.
83 84 85 86 |
# File 'options.rb', line 83 def initialize_dup(other) super @options = @options.dup end |
#inspect ⇒ 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 inspect "#<#{self.class.name}: #{to_a.inspect}>" end |
#to_s ⇒ 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.
143 144 145 |
# File 'options.rb', line 143 def to_s @options.map(&:to_s).join(" ") 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.
114 115 116 |
# File 'options.rb', line 114 def |(other) self.class.new(@options | other) end |