Sha256: e764bd0948eee05e31225e01a242e51bfa9e8d541868e9f6008a378bd427ae64
Contents?: true
Size: 752 Bytes
Versions: 2
Compression:
Stored size: 752 Bytes
Contents
# frozen_string_literal: true require_relative './entry' class ActiveSet class Instructions attr_reader :hash def initialize(hash) @hash = hash @flattened_hash = hash.flatten_keys.transform_keys { |k| k.map(&:to_s) } end def process_adapter(set:, adapter:) @flattened_hash.reduce(set) do |inner_set, (keypath, value)| instruction = Entry.new(keypath, value) output = adapter.new(inner_set, instruction).process remove_from_instruction_set(key: instruction.path) if output[:processed] output[:set] end end def get(keypath) @hash.dig(*keypath) end private def remove_from_instruction_set(key:) @flattened_hash.delete(key) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activeset-0.4.1 | lib/active_set/instructions/base.rb |
activeset-0.4.0 | lib/active_set/instructions/base.rb |