Class: ResourceStageContext

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
brew/Library/Homebrew/resource.rb

Overview

The context in which a Resource#stage occurs. Supports access to both the Resource and associated Mktemp in a single block argument. The interface is back-compatible with Resource itself as used in that context.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, staging) ⇒ ResourceStageContext

Returns a new instance of ResourceStageContext



226
227
228
229
# File 'brew/Library/Homebrew/resource.rb', line 226

def initialize(resource, staging)
  @resource = resource
  @staging = staging
end

Instance Attribute Details

#resourceObject (readonly)

The Resource that is being staged



219
220
221
# File 'brew/Library/Homebrew/resource.rb', line 219

def resource
  @resource
end

#stagingObject (readonly)

The Mktemp in which #resource is staged



221
222
223
# File 'brew/Library/Homebrew/resource.rb', line 221

def staging
  @staging
end

Instance Method Details

#to_sObject



231
232
233
# File 'brew/Library/Homebrew/resource.rb', line 231

def to_s
  "<#{self.class}: resource=#{resource} staging=#{staging}>"
end