Class: Patch::Patch

Inherits:
Object
  • Object
show all
Defined in:
lib/patch/patch.rb

Overview

A single patch consisting of a node mapping and actions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, maps, actions) ⇒ Patch

Returns a new instance of Patch.

Parameters:

  • name (Symbol, String)
  • maps (Array<Node::Map>, Node::Map)

    A node map or maps

  • actions (Array<Hash>, Hash)

    An action or actions



11
12
13
14
# File 'lib/patch/patch.rb', line 11

def initialize(name, maps, actions)
  @name = name
  populate(maps, actions)
end

Instance Attribute Details

#actionsObject (readonly)

Returns the value of attribute actions.



6
7
8
# File 'lib/patch/patch.rb', line 6

def actions
  @actions
end

#mapsObject (readonly)

Returns the value of attribute maps.



6
7
8
# File 'lib/patch/patch.rb', line 6

def maps
  @maps
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/patch/patch.rb', line 6

def name
  @name
end

Instance Method Details

#enableBoolean

Enable the given nodes to implement this patch

Parameters:

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/patch/patch.rb', line 19

def enable
  result = @maps.map { |map| map.enable(self) }
  result.any?
end