Sha256: af5973ccfcae538465d85d451799f35890d414affe3656223fdd59fc3395d062

Contents?: true

Size: 808 Bytes

Versions: 16

Compression:

Stored size: 808 Bytes

Contents

# frozen_string_literal: true

module ROM
  module SQL
    # @api private
    module AttributeWrapping
      # Return if the attribute type is from a wrapped relation
      #
      # Wrapped attributes are used when two schemas from different relations
      # are merged together. This way we can identify them easily and handle
      # correctly in places like auto-mapping.
      #
      # @api public
      def wrapped?
        !meta[:wrapped].nil?
      end

      # Return attribute type wrapped for the specified relation name
      #
      # @param [Symbol] name The name of the source relation (defaults to source.dataset)
      #
      # @return [Attribute]
      #
      # @api public
      def wrapped(name = source.dataset)
        meta(wrapped: name).prefixed(name)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
rom-sql-3.7.0 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.6.5 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.6.4 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.6.3 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.6.2 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.6.1 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.6.0 lib/rom/sql/attribute_wrapping.rb
rom-sql-4.0.0.alpha1 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.5.0 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.4.0 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.3.3 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.3.2 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.3.1 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.3.0 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.2.0 lib/rom/sql/attribute_wrapping.rb
rom-sql-3.1.0 lib/rom/sql/attribute_wrapping.rb