Sha256: 72106d36d9f182d50830667dba7abc24f03448767ec82708105f55a63017bbba

Contents?: true

Size: 452 Bytes

Versions: 5

Compression:

Stored size: 452 Bytes

Contents

require "rails/generators"

module Mongoid
  # Generate SyncMachine files for Mongoid.
  class SyncMachineGenerator < Rails::Generators::NamedBase
    class_option :subject, type: :string
    source_root File.expand_path('templates', __dir__)

    def create_payload_file
      template "payload.rb", "app/models/#{file_path}/payload.rb"
    end

    private

    def subject
      options['subject'] || file_name.split(/_to_/).first
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sync_machine-1.4.0 lib/rails/generators/mongoid/sync_machine_generator.rb
sync_machine-1.3.0 lib/rails/generators/mongoid/sync_machine_generator.rb
sync_machine-1.2.0 lib/rails/generators/mongoid/sync_machine_generator.rb
sync_machine-1.1.1 lib/rails/generators/mongoid/sync_machine_generator.rb
sync_machine-1.1.0 lib/rails/generators/mongoid/sync_machine_generator.rb