lib/clowne/cloner.rb in clowne-0.1.0.pre1 vs lib/clowne/cloner.rb in clowne-0.1.0
- old
+ new
@@ -36,12 +36,12 @@
@traits ||= {}
@traits[name] ||= Declarations::Trait.new
@traits[name].extend_with(block)
end
- # rubocop: disable Metrics/AbcSize
- # rubocop: disable Metrics/MethodLength
+ # rubocop: disable Metrics/AbcSize, Metrics/MethodLength
+ # rubocop: disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def call(object, **options)
raise(UnprocessableSourceError, 'Nil is not cloneable object') if object.nil?
raise(ConfigurationError, 'Adapter is not defined') if adapter.nil?
@@ -54,14 +54,16 @@
default_plan
else
plan_with_traits(traits)
end
+ plan = Clowne::Planner.enhance(plan, Proc.new) if block_given?
+
adapter.clone(object, plan, params: options)
end
- # rubocop: enable Metrics/AbcSize
- # rubocop: enable Metrics/MethodLength
+ # rubocop: enable Metrics/AbcSize, Metrics/MethodLength
+ # rubocop: enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
def default_plan
return @default_plan if instance_variable_defined?(:@default_plan)
@default_plan = Clowne::Planner.compile(self)
end