jobs/transforms/prefix_job.rb in remi-0.2.42 vs jobs/transforms/prefix_job.rb in remi-0.3.0
- old
+ new
@@ -1,19 +1,22 @@
require_relative '../all_jobs_shared'
-class PrefixJob
- include AllJobsShared
+class PrefixJob < Remi::Job
- define_param :prefix, 'prefix'
- define_source :source_data, Remi::DataSource::DataFrame,
- fields: {
- :my_field => {}
- }
- define_target :target_data, Remi::DataTarget::DataFrame
+ param(:prefix) { 'prefix' }
+ source :source_data do
+ fields(
+ {
+ :my_field => {}
+ }
+ )
+ end
- define_transform :main, sources: :source_data, targets: :target_data do
+ target :target_data
+
+ transform :main do
Remi::SourceToTargetMap.apply(source_data.df, target_data.df) do
map source(:my_field) .target(:prefixed_field)
- .transform(Remi::Transform::Prefix.new(params[:prefix]))
+ .transform(Remi::Transform::Prefix.new(job.params[:prefix]))
end
end
end