Sha256: a8bdb7cbabb7a7ca278efc41ec027d39c8dc74b38495404a70613b38437ac22b

Contents?: true

Size: 556 Bytes

Versions: 13

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

# GroupAction is compose of multiple actions.
class NodeMutation::GroupAction < NodeMutation::Action
  DEFAULT_START = 2**30

  # Initialize a GroupAction.
  def initialize
    @actions = []
    @type = :group
  end

  def new_code
    nil
  end

  private

  # Calculate the begin and end positions.
  def calculate_position
    @start = DEFAULT_START
    @end = 0
    NodeMutation::Helper.iterate_actions(@actions) do |action|
      @start = [action.start, @start].min
      @end = [action.end, @end].max
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
node_mutation-1.24.4 lib/node_mutation/action/group_action.rb
node_mutation-1.24.3 lib/node_mutation/action/group_action.rb
node_mutation-1.24.2 lib/node_mutation/action/group_action.rb
node_mutation-1.24.1 lib/node_mutation/action/group_action.rb
node_mutation-1.24.0 lib/node_mutation/action/group_action.rb
node_mutation-1.23.3 lib/node_mutation/action/group_action.rb
node_mutation-1.23.2 lib/node_mutation/action/group_action.rb
node_mutation-1.23.1 lib/node_mutation/action/group_action.rb
node_mutation-1.23.0 lib/node_mutation/action/group_action.rb
node_mutation-1.22.4 lib/node_mutation/action/group_action.rb
node_mutation-1.22.2 lib/node_mutation/action/group_action.rb
node_mutation-1.22.1 lib/node_mutation/action/group_action.rb
node_mutation-1.22.0 lib/node_mutation/action/group_action.rb