Sha256: d87dea42cea36c4d3836c5f0f6ef0dc7e09c7bed91c47331414398180fae79a6

Contents?: true

Size: 416 Bytes

Versions: 1

Compression:

Stored size: 416 Bytes

Contents

# frozen_string_literal: true

class <%= class_name %>Contract < ActiveTransaction::ApplicationContract
  params do
    <% fields.each do |field| %>
    <% params = field.split(':') %>
    <% if params[1] == 'optional' %>
    optional(:<%= params[0] %>).maybe(:<%= params[2] || 'string' %>)
      <% else %>
    required(:<%= params[0] %>).filled(:<%= params[1] || 'string' %>)
    <% end %>
    <% end %>
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_transaction-0.1.2 lib/generators/templates/contract.rb.erb