Class: Mogura::Builder::Dag

Inherits:
Object
  • Object
show all
Defined in:
lib/mogura/builder.rb

Class Method Summary collapse

Class Method Details

.build(name: '', tasks: {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/mogura/builder.rb', line 5

def build(name: '', tasks: {})

  dag = Struct.new("Dag", :name, :tasks) do
    def content
      export = {
        "_export": {
          "rb": {
            "require": Rails.root.join('config/environment').to_s
          }
        }
      }.freeze
      JSON.pretty_generate(export.merge(tasks))
    end
  end
  dag.new(name, tasks)
end