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



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

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

Instance Attribute Details

#resourceObject (readonly)

The Resource that is being staged



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

def resource
  @resource
end

#stagingObject (readonly)

The Mktemp in which #resource is staged



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

def staging
  @staging
end

Instance Method Details

#to_sObject



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

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