class Graphoid::EmbedsMany

Public Instance Methods

create(parent, values, _) click to toggle source
# File lib/graphoid/operators/inherited/embeds_many.rb, line 5
def create(parent, values, _)
  values.each do |value|
    attributes = Attribute.correct(klass, value)
    parent.send(:"#{name}").create!(attributes)
  end
end
exec(_scope, value) click to toggle source
# File lib/graphoid/operators/inherited/embeds_many.rb, line 12
def exec(_scope, value)
  _hash = {}

  value.each do |key, _value|
    operation = Operation.new(klass, key, _value)
    parsed = Graphoid.driver.parse(operation.operand, operation.value, operation.operator, klass.to_s.underscore.pluralize)
    _hash.merge!(parsed)
  end

  _hash
end