Class: Gaskit::Generators::FlowGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/gaskit/operation/flow_generator.rb

Overview

Generates a new Gaskit::Flow class using the class-based DSL.

This generator creates a flow subclass using statically defined steps.

Examples:

Generates a class like:

class CheckoutFlow < Gaskit::Flow
  step AddToCart
  step ApplyDiscount
  step Finalize
end

CheckoutFlow.call(user_id: 123)

rails generate gaskit:flow Checkout AddToCart ApplyDiscount Finalize

See Also:

  • for the ERB template used.

Instance Method Summary collapse

Instance Method Details

#create_flow_fileObject



29
30
31
# File 'lib/generators/gaskit/operation/flow_generator.rb', line 29

def create_flow_file
  template "flow.rb.tt", File.join("app/flows", class_path, "#{file_name}_flow.rb")
end