Sha256: 1f53a78b98ce5587e7997a2711016ed5c18f4f11e58303d52d0f74c763ef96b3

Contents?: true

Size: 318 Bytes

Versions: 1

Compression:

Stored size: 318 Bytes

Contents

# frozen_string_literal: true

module GetYourRep
  # Methods for making associations between objects.
  module Associations
    def add_child(other:, model:, children:, error:)
      if other.is_a?(model)
        instance_variable_get("@#{children}") << other
      else
        error.call
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
get_your_rep-1.2.0 lib/get_your_rep/associations.rb