Skip to content

Commit 363e945

Browse files
swerlingnepalez
authored andcommitted
(squash me) Make Codacy happy
Tweak to satisfy Codacy Static Code Analysis
1 parent 333d3ec commit 363e945

File tree

1 file changed

+1
-25
lines changed

1 file changed

+1
-25
lines changed

lib/dry/initializer/builders/attribute.rb

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def coercion_line
7171

7272
arity = @type.is_a?(Proc) ? @type.arity : @type.method(:call).arity
7373
type_call_params = \
74-
(arity.equal?(1) || arity.negative?) ? @val : "#{@val}, self"
74+
arity.equal?(1) || arity.negative? ? @val : "#{@val}, self"
7575

7676
<<-COERCE
7777
begin
@@ -84,30 +84,6 @@ def coercion_line
8484
COERCE
8585
end
8686

87-
def coercion_lineSAVE
88-
return unless @type
89-
90-
arity = @type.is_a?(Proc) ? @type.arity : @type.method(:call).arity
91-
92-
if arity.equal?(1) || arity.negative?
93-
<<-METH
94-
begin
95-
#{@val} = #{@item}.type.call(#{@val}) unless #{@null} == #{@val}
96-
rescue Dry::Types::ConstraintError => e
97-
raise Dry::Initializer::CoercionError.new(e, '#{@source}')
98-
end
99-
METH
100-
else
101-
<<-METH
102-
begin
103-
#{@val} = #{@item}.type.call(#{@val}, self) unless #{@null} == #{@val}
104-
rescue Dry::Types::ConstraintError => e
105-
raise Dry::Initializer::CoercionError.new(e, '#{@source}')
106-
end
107-
METH
108-
end
109-
end
110-
11187
def assignment_line
11288
"#{@ivar} = #{@val}" \
11389
" unless #{@null} == #{@val} && instance_variable_defined?(:#{@ivar})"

0 commit comments

Comments
 (0)