Class: ROM::Factory::Attributes::Association::OneToMany Private

Inherits:
Core
  • Object
show all
Defined in:
lib/rom/factory/attributes/association.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Direct Known Subclasses

OneToOne

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from ROM::Factory::Attributes::Association::Core

Instance Method Details

#call(attrs = EMPTY_HASH, parent) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



64
65
66
67
68
69
70
71
72
# File 'lib/rom/factory/attributes/association.rb', line 64

def call(attrs = EMPTY_HASH, parent)
  return if attrs.key?(name)

  structs = count.times.map {
    builder.persistable.create(assoc.associate(attrs, parent))
  }

  { name => structs }
end

#countObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



80
81
82
# File 'lib/rom/factory/attributes/association.rb', line 80

def count
  options.fetch(:count)
end

#dependency?(rel) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


75
76
77
# File 'lib/rom/factory/attributes/association.rb', line 75

def dependency?(rel)
  assoc.source == rel
end