Class: ResourceStageContext

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
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



234
235
236
237
# File 'Library/Homebrew/resource.rb', line 234

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

Instance Attribute Details

#resourceObject (readonly)

The Resource that is being staged



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

def resource
  @resource
end

#stagingObject (readonly)

The Mktemp in which @resource is staged



229
230
231
# File 'Library/Homebrew/resource.rb', line 229

def staging
  @staging
end

Instance Method Details

#to_sObject



239
240
241
# File 'Library/Homebrew/resource.rb', line 239

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