lib/hanami/model/association.rb in hanami-model-1.3.2 vs lib/hanami/model/association.rb in hanami-model-1.3.3
- old
+ new
@@ -1,11 +1,13 @@
-require 'rom-sql'
-require 'hanami/model/associations/belongs_to'
-require 'hanami/model/associations/has_many'
-require 'hanami/model/associations/has_one'
-require 'hanami/model/associations/many_to_many'
+# frozen_string_literal: true
+require "rom-sql"
+require "hanami/model/associations/belongs_to"
+require "hanami/model/associations/has_many"
+require "hanami/model/associations/has_one"
+require "hanami/model/associations/many_to_many"
+
module Hanami
module Model
# Association factory
#
# @since 0.7.0
@@ -22,11 +24,10 @@
# Translate ROM SQL associations into Hanami::Model associations
#
# @since 0.7.0
# @api private
- # rubocop:disable Metrics/MethodLength
def self.lookup(association)
case association
when ROM::SQL::Association::ManyToMany
Associations::ManyToMany
when ROM::SQL::Association::OneToOne
@@ -37,9 +38,8 @@
Associations::BelongsTo
else
raise "Unsupported association: #{association}"
end
end
- # rubocop:enable Metrics/MethodLength
end
end
end