Class: Requirement::Satisfier

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

Instance Method Summary collapse

Constructor Details

#initialize(options, &block) ⇒ Satisfier

Returns a new instance of Satisfier



162
163
164
165
166
167
168
169
170
171
# File 'Library/Homebrew/requirement.rb', line 162

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



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

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