lib/sql_runner/query/model.rb in sql_runner-0.1.0 vs lib/sql_runner/query/model.rb in sql_runner-0.2.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module SQLRunner
class Query
module Model
def self.activate(target, model)
target.singleton_class.class_eval do
@@ -11,10 +13,10 @@
end
def call(**bind_vars)
result = super(**bind_vars)
return unless result
- return model.new(result) if result.kind_of?(Hash)
+ return model.new(result) if result.is_a?(Hash)
result.to_a.map do |attrs|
model.new(attrs)
end
end