class LunaPark::Mappers::Codirectional::Copyists::Slice

Copyist for copiyng value between two schemas with SAME and PLAIN paths

Public Class Methods

new() click to toggle source
# File lib/luna_park/mappers/codirectional/copyists/slice.rb, line 9
def initialize
  @keys = []
end

Public Instance Methods

add_key(key) click to toggle source
# File lib/luna_park/mappers/codirectional/copyists/slice.rb, line 13
def add_key(key)
  @keys << key
end
from_row(row:, attrs:) click to toggle source
# File lib/luna_park/mappers/codirectional/copyists/slice.rb, line 17
def from_row(row:, attrs:)
  attrs.merge! row.slice(*@keys)
end
to_row(row:, attrs:) click to toggle source
# File lib/luna_park/mappers/codirectional/copyists/slice.rb, line 21
def to_row(row:, attrs:)
  row.merge! attrs.slice(*@keys)
end