Sha256: 4cccc75be55ce5c5fe557aff654447d991cc05e289347e66b32bebd0b226b278

Contents?: true

Size: 526 Bytes

Versions: 3

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

class NodeMutation::Result
  attr_accessor :file_path

  def initialize(options)
    @options = options
  end

  def affected?
    @options[:affected]
  end

  def conflicted?
    @options[:conflicted]
  end

  def actions
    @options[:actions]
  end

  def new_source
    @options[:new_source]
  end

  def to_hash
    hash = { file_path: file_path }
    @options.each do |key, value|
      hash[key] = value.is_a?(Array) ? value.map { |action| action.to_h } : value
    end
    hash
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
node_mutation-1.4.1 lib/node_mutation/result.rb
node_mutation-1.4.0 lib/node_mutation/result.rb
node_mutation-1.3.3 lib/node_mutation/result.rb