Class: Requirement::Satisfier

Inherits:
Object
  • Object
show all
Defined in:
brew/Library/Homebrew/requirement.rb

Instance Method Summary collapse

Constructor Details

#initialize(options, &block) ⇒ Satisfier

Returns a new instance of Satisfier



173
174
175
176
177
178
179
180
181
182
# File 'brew/Library/Homebrew/requirement.rb', line 173

def initialize(options, &block)
  case options
  when Hash
    @options = { build_env: true }
    @options.merge!(options)
  else
    @satisfied = options
  end
  @proc = block
end

Instance Method Details

#yielderObject



184
185
186
187
188
189
190
191
192
193
# File 'brew/Library/Homebrew/requirement.rb', line 184

def yielder
  if instance_variable_defined?(:@satisfied)
    @satisfied
  elsif @options[:build_env]
    require "extend/ENV"
    ENV.with_build_environment { yield @proc }
  else
    yield @proc
  end
end