Skip to content

Commit

Permalink
Set property destination to DerivatedTagTransformer
Browse files Browse the repository at this point in the history
  • Loading branch information
frodrigo committed Feb 16, 2024
1 parent c234837 commit 9619eef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion datasources/transforms/derivated_tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class DerivatedTagTransformer < Transformer
extend T::Sig

class Settings < Transformer::TransformerSettings
const :property, String
const :key, String
const :value, String
end
Expand All @@ -18,12 +19,13 @@ class Settings < Transformer::TransformerSettings
sig { params(settings: Settings).void }
def initialize(settings)
super(settings)
@property = settings.property.to_sym
@key = settings.key.to_sym
@lambda_value = eval(settings.value)
end

def process_data(row)
row[:properties][:tags][@key] = @lambda_value.call(row[:properties])
row[:properties][@property][@key] = @lambda_value.call(row[:properties])
row
end
end

0 comments on commit 9619eef

Please sign in to comment.