Sha256: 956fc4928a59023929f6e56ca0c16bd4047529aca9d73e587d4b8d65536f729e

Contents?: true

Size: 552 Bytes

Versions: 1

Compression:

Stored size: 552 Bytes

Contents

# frozen_string_literal: true

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

  attr_accessor :actions

  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

1 entries across 1 versions & 1 rubygems

Version Path
node_mutation-1.21.0 lib/node_mutation/action/group_action.rb