thbar / kiba

Data processing & ETL framework for Ruby
https://www.kiba-etl.org
Other
1.75k stars 87 forks source link

Support block as parameter for "Kiba.run" calls #94

Closed thbar closed 4 years ago

thbar commented 4 years ago

The usual way to create a Kiba job these days is:

module ETL
  module MyJob
    module_function

    def setup(config)
      Kiba.parse do
        # SNIP (job definition)
      end
    end
  end
end

Then one would invoke it with:

Kiba.run(ETL::MyJob.setup(config))

On occasions, though (e.g. one-off scripts, or during initial prototyping) it can be useful to avoid that and just work inline:

Kiba.run(Kiba.parse do
  # SNIP (job definition)
end)

This PR introduces a shortcut for this type of work, where you can just run the job with:

Kiba.run do
  # SNIP (job definition)
end