Sha256: 9919f8d32f82099c79ac756d35f4eec8eb71590bd1214f7255944a4f9ea148e5

Contents?: true

Size: 545 Bytes

Versions: 18

Compression:

Stored size: 545 Bytes

Contents

# frozen_string_literal: true

class NodeMutation::Result
  attr_accessor :file_path, :new_source, :actions
  attr_reader :actions

  def initialize(affected:, conflicted:)
    @affected = affected
    @conflicted = conflicted
    @actions = []
  end

  def affected?
    @affected
  end

  def conflicted?
    @conflicted
  end

  def to_json(*args)
    data = { affected: affected?, conflicted: conflicted? }
    data[:new_source] = new_source if new_source
    data[:actions] = actions unless actions.empty?
    data.to_json(*args)
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
node_mutation-1.24.4 lib/node_mutation/result.rb
node_mutation-1.24.3 lib/node_mutation/result.rb
node_mutation-1.24.2 lib/node_mutation/result.rb
node_mutation-1.24.1 lib/node_mutation/result.rb
node_mutation-1.24.0 lib/node_mutation/result.rb
node_mutation-1.23.3 lib/node_mutation/result.rb
node_mutation-1.23.2 lib/node_mutation/result.rb
node_mutation-1.23.1 lib/node_mutation/result.rb
node_mutation-1.23.0 lib/node_mutation/result.rb
node_mutation-1.22.4 lib/node_mutation/result.rb
node_mutation-1.22.3 lib/node_mutation/result.rb
node_mutation-1.22.2 lib/node_mutation/result.rb
node_mutation-1.22.1 lib/node_mutation/result.rb
node_mutation-1.22.0 lib/node_mutation/result.rb
node_mutation-1.21.6 lib/node_mutation/result.rb
node_mutation-1.21.5 lib/node_mutation/result.rb
node_mutation-1.21.4 lib/node_mutation/result.rb
node_mutation-1.21.3 lib/node_mutation/result.rb