Sha256: 6ffcfb9249ebd42d963bd79c78962916e096cc3f06e187fd57899ab4bdaec8c1

Contents?: true

Size: 814 Bytes

Versions: 15

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

require 'rom/support/inflector'

module ROM
  module Associations
    # @api private
    class ThroughIdentifier
      # @api private
      attr_reader :source

      # @api private
      attr_reader :target

      # @api private
      attr_reader :assoc_name

      # @api private
      def self.[](source, target, assoc_name = nil)
        new(source, target, assoc_name || default_assoc_name(target))
      end

      # @api private
      def self.default_assoc_name(relation)
        Inflector.singularize(relation).to_sym
      end

      # @api private
      def initialize(source, target, assoc_name)
        @source = source
        @target = target
        @assoc_name = assoc_name
      end

      # @api private
      def to_sym
        source
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rom-core-5.3.2 lib/rom/associations/through_identifier.rb
rom-core-5.3.1 lib/rom/associations/through_identifier.rb
rom-core-5.3.0 lib/rom/associations/through_identifier.rb
rom-core-5.2.6 lib/rom/associations/through_identifier.rb
rom-core-5.2.5 lib/rom/associations/through_identifier.rb
rom-core-5.2.4 lib/rom/associations/through_identifier.rb
rom-core-5.2.3 lib/rom/associations/through_identifier.rb
rom-core-5.2.2 lib/rom/associations/through_identifier.rb
rom-core-5.2.1 lib/rom/associations/through_identifier.rb
rom-core-5.1.2 lib/rom/associations/through_identifier.rb
rom-core-5.1.1 lib/rom/associations/through_identifier.rb
rom-core-5.1.0 lib/rom/associations/through_identifier.rb
rom-core-5.0.2 lib/rom/associations/through_identifier.rb
rom-core-5.0.1 lib/rom/associations/through_identifier.rb
rom-core-5.0.0 lib/rom/associations/through_identifier.rb