Sha256: cd99cff4278b66c6d3421223ce5fe95ba023cc8edff00aa1bf0377aadf77a886

Contents?: true

Size: 510 Bytes

Versions: 16

Compression:

Stored size: 510 Bytes

Contents

require 'generators/rom'

module ROM
  module Generators
    class MapperGenerator < Base
      def create_mapper_file
        template(
          'mapper.rb.erb',
          File.join('app', 'mappers', "#{file_name.singularize}_mapper.rb")
        )
      end

      private

      def model_name
        class_name.singularize
      end

      def relation
        class_name.pluralize.underscore
      end

      def register_as
        model_name.singularize.underscore.downcase
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rom-rails-2.4.0 lib/generators/rom/mapper_generator.rb
rom-rails-2.3.1 lib/generators/rom/mapper_generator.rb
rom-rails-2.3.0 lib/generators/rom/mapper_generator.rb
rom-rails-2.2.0 lib/generators/rom/mapper_generator.rb
rom-rails-2.0.0 lib/generators/rom/mapper_generator.rb
rom-rails-1.2.0 lib/generators/rom/mapper_generator.rb
rom-rails-1.1.1 lib/generators/rom/mapper_generator.rb
rom-rails-1.1.0 lib/generators/rom/mapper_generator.rb
rom-rails-1.0.1 lib/generators/rom/mapper_generator.rb
rom-rails-1.0.0 lib/generators/rom/mapper_generator.rb
rom-rails-1.0.0.rc1 lib/generators/rom/mapper_generator.rb
rom-rails-1.0.0.beta1 lib/generators/rom/mapper_generator.rb
rom-rails-0.9.0 lib/generators/rom/mapper_generator.rb
rom-rails-0.9.0.beta1 lib/generators/rom/mapper_generator.rb
rom-rails-0.8.0 lib/generators/rom/mapper_generator.rb
rom-rails-0.7.0 lib/generators/rom/mapper_generator.rb