File: association.rb

package info (click to toggle)
ruby-bullet 7.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 836 kB
  • sloc: ruby: 6,133; javascript: 57; sh: 27; makefile: 4
file content (16 lines) | stat: -rw-r--r-- 394 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

module Bullet
  module Registry
    class Association < Base
      def merge(base, associations)
        @registry.merge!(base => associations)
      end

      def similarly_associated(base, associations)
        @registry.select { |key, value| key.include?(base) && value == associations }
                 .collect(&:first).flatten
      end
    end
  end
end