lib/clowne/cloner.rb in clowne-1.1.0 vs lib/clowne/cloner.rb in clowne-1.2.0
- old
+ new
@@ -1,12 +1,12 @@
# frozen_string_literal: true
-require 'clowne/planner'
-require 'clowne/dsl'
-require 'clowne/utils/options'
-require 'clowne/utils/params'
-require 'clowne/utils/operation'
+require "clowne/planner"
+require "clowne/dsl"
+require "clowne/utils/options"
+require "clowne/utils/params"
+require "clowne/utils/operation"
module Clowne # :nodoc: all
class UnprocessableSourceError < StandardError; end
class ConfigurationError < StandardError; end
@@ -43,16 +43,16 @@
@traits[name].extend_with(block)
end
# rubocop: disable Metrics/AbcSize, Metrics/MethodLength
def call(object, **options)
- raise(UnprocessableSourceError, 'Nil is not cloneable object') if object.nil?
+ raise(UnprocessableSourceError, "Nil is not cloneable object") if object.nil?
options = Clowne::Utils::Options.new(options)
current_adapter = current_adapter(options.adapter)
- raise(ConfigurationError, 'Adapter is not defined') if current_adapter.nil?
+ raise(ConfigurationError, "Adapter is not defined") if current_adapter.nil?
plan =
if options.traits.empty?
default_plan(current_adapter: current_adapter)
else
@@ -77,10 +77,10 @@
@default_plan = Clowne::Planner.compile(current_adapter, self)
end
def plan_with_traits(ids, current_adapter: adapter)
# Cache plans for combinations of traits
- traits_id = ids.map(&:to_s).join(':')
+ traits_id = ids.map(&:to_s).join(":")
return traits_plans[traits_id] if traits_plans.key?(traits_id)
traits_plans[traits_id] = Clowne::Planner.compile(
current_adapter, self, traits: ids
)