Module: Flatter::Mapper::Collection::FactoryMethods

Included in:
Factory
Defined in:
lib/flatter/mapper/collection.rb

Instance Method Summary collapse

Instance Method Details

#collection?Boolean

Returns:

  • (Boolean)


20
21
22
23
# File 'lib/flatter/mapper/collection.rb', line 20

def collection?
  options[:collection] == true ||
    (options[:collection] != false && name == name.pluralize)
end

#createObject



10
11
12
13
14
# File 'lib/flatter/mapper/collection.rb', line 10

def create(*)
  super.tap do |mapper|
    mapper.options.merge!(collection: collection?)
  end
end

#default_mapper_class_nameObject



16
17
18
# File 'lib/flatter/mapper/collection.rb', line 16

def default_mapper_class_name
  collection? ? "#{name.singularize.camelize}Mapper" : super
end