Sha256: beefb62840bc314741e5c30feb6eea14407735137ba91377cc517a8947c906d2
Contents?: true
Size: 894 Bytes
Versions: 3
Compression:
Stored size: 894 Bytes
Contents
require 'arc-furnace/node' module ArcFurnace class Hash < Node attr_reader :key_column private_attr_reader :source, :hash def initialize(source: , key_column:) @source = source @key_column = key_column @hash = {} end # Pass a block that accepts two argument, the join key # for each value and the value def each(&block) hash.each(&block) end def prepare loop do break if source.empty? row = source.row key = row[key_column] if key if hash.include?(key) error_handler.duplicate_primary_key(duplicate_row: row, key: key, node_id: node_id) end hash[key] = row else error_handler.missing_primary_key(source_row: row, node_id: node_id) end end end def get(primary_key) hash[primary_key] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
arc-furnace-0.1.4 | lib/arc-furnace/hash.rb |
arc-furnace-0.1.3 | lib/arc-furnace/hash.rb |
arc-furnace-0.1.0 | lib/arc-furnace/hash.rb |