123456789_123456789_123456789_123456789_123456789_

Class: Gem::Resolver::Molinillo::DependencyGraph::SetPayload

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Action
Instance Chain:
self, Action
Inherits: Gem::Resolver::Molinillo::DependencyGraph::Action
Defined in: lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb

Overview

See Also:

Action

SetPayload

Class Method Summary

Action - Inherited

Instance Attribute Summary

Action - Inherited

Instance Method Summary

Action - Inherited

#down

Reverses the action on the given graph.

#up

Performs the action on the given graph.

Constructor Details

.new(name, payload) ⇒ SetPayload

Initialize an action to add set the payload for a vertex in a dependency graph

Parameters:

  • name (String)

    the name of the vertex

  • payload (Object)

    the payload for the vertex

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb', line 40

def initialize(name, payload)
  @name = name
  @payload = payload
end

Class Method Details

.action_nameSymbol

Returns:

  • (Symbol)

    The name of the action.

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb', line 12

def self.action_name
  :set_payload
end

Instance Attribute Details

#nameString (readonly)

Returns:

  • (String)

    the name of the vertex

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb', line 31

attr_reader :name

#payloadObject (readonly)

Returns:

  • (Object)

    the payload for the vertex

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb', line 34

attr_reader :payload

Instance Method Details

#down(graph) ⇒ Void

Reverses the action on the given graph.

Parameters:

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb', line 24

def down(graph)
  graph.vertex_named(name).payload = @old_payload
end

#up(graph) ⇒ Void

Performs the action on the given graph.

Parameters:

[ GitHub ]

  
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph/set_payload.rb', line 17

def up(graph)
  vertex = graph.vertex_named(name)
  @old_payload = vertex.payload
  vertex.payload = payload
end