Sha256: 1c3182ab84875baf1669b4631c75507ad1e1e0980d8163f2434f756e30c99866

Contents?: true

Size: 727 Bytes

Versions: 1

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Clowne
  module Declarations
    class ExcludeAssociation # :nodoc: all
      attr_accessor :name

      def initialize(name)
        @name = name.to_sym
      end

      def compile(plan)
        plan.remove_from(:association, name)

        # update all_associations plan
        all_associations = plan.get(:all_associations)
        return if all_associations.nil?
        all_associations.except! name
      end
    end
  end
end

Clowne::Declarations.add :exclude_association, Clowne::Declarations::ExcludeAssociation
Clowne::Declarations.add :exclude_associations do |*names|
  names.each do |name|
    declarations.push Clowne::Declarations::ExcludeAssociation.new(name)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clowne-0.1.0.pre1 lib/clowne/declarations/exclude_association.rb