Sha256: fdb246ee917cf5e7fead80b288c06969e7e38e02324ffd3dc76c3a9e1d3711eb

Contents?: true

Size: 482 Bytes

Versions: 1

Compression:

Stored size: 482 Bytes

Contents

# frozen_string_literal: true

class NodeMutation::Result
  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
    @options.each_pair.with_object({}) do |(key, value), hash|
      hash[key] = value.is_a?(Array) ? value.map { |action| action.to_h } : value
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
node_mutation-1.3.1 lib/node_mutation/result.rb