Sha256: c7a1183e3896475b56ce1b696df270544db54fb31310397a04fe8653a5a6e454
Contents?: true
Size: 715 Bytes
Versions: 8
Compression:
Stored size: 715 Bytes
Contents
# frozen_string_literal: true class NodeMutation::Result attr_accessor :file_path, :new_source attr_reader :actions def initialize(affected:, conflicted:) @affected = affected @conflicted = conflicted @actions = [] end def affected? @affected end def conflicted? @conflicted end def actions=(actions) @actions = actions.map { |action| NodeMutation::Struct::Action.new(action.type, action.start, action.end, action.new_code) } 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
8 entries across 8 versions & 1 rubygems