Class: CommonRepositoryModel::CollectionGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/common_repository_model/collection/collection_generator.rb

Instance Method Summary collapse

Instance Method Details

#create_collectionObject



8
9
10
11
12
13
# File 'lib/generators/common_repository_model/collection/collection_generator.rb', line 8

def create_collection
  template(
    'collection.rb.erb',
    File.join('app/repository_models/', "#{file_name}.rb")
  )
end

#create_fixture_fileObject



22
23
24
# File 'lib/generators/common_repository_model/collection/collection_generator.rb', line 22

def create_fixture_file
  template 'collection_factory.rb.erb', File.join(options[:test_dir], "#{file_name}_factory.rb")
end

#create_serializerObject



26
27
28
29
30
31
# File 'lib/generators/common_repository_model/collection/collection_generator.rb', line 26

def create_serializer
  template(
    'collection_serializer.rb.erb',
    File.join('app/repository_serializers/', "#{file_name}_serializer.rb")
  )
end

#create_serializer_specObject



33
34
35
36
37
38
# File 'lib/generators/common_repository_model/collection/collection_generator.rb', line 33

def create_serializer_spec
  template(
    'collection_serializer_spec.rb.erb',
    File.join('spec/repository_serializers/', "#{file_name}_serializer_spec.rb")
  )
end

#create_service_specObject



15
16
17
18
19
20
# File 'lib/generators/common_repository_model/collection/collection_generator.rb', line 15

def create_service_spec
  template(
    'collection_spec.rb.erb',
    File.join('spec/repository_models/', "#{file_name}_spec.rb")
  )
end