File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
lib/dry/initializer/builders Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -60,22 +60,22 @@ def definition_line
60
60
61
61
def default_line
62
62
return unless @default
63
- "#{ @val } = instance_exec(&#{ @item } .default) if #{ @val } == #{ @null } "
63
+ "#{ @val } = instance_exec(&#{ @item } .default) if #{ @null } == #{ @val } "
64
64
end
65
65
66
66
def coercion_line
67
67
return unless @type
68
68
arity = @type . is_a? ( Proc ) ? @type . arity : @type . method ( :call ) . arity
69
69
if arity . abs == 1
70
- "#{ @val } = #{ @item } .type.call(#{ @val } ) unless #{ @val } == #{ @null } "
70
+ "#{ @val } = #{ @item } .type.call(#{ @val } ) unless #{ @null } == #{ @val } "
71
71
else
72
- "#{ @val } = #{ @item } .type.call(#{ @val } , self) unless #{ @val } == #{ @null } "
72
+ "#{ @val } = #{ @item } .type.call(#{ @val } , self) unless #{ @null } == #{ @val } "
73
73
end
74
74
end
75
75
76
76
def assignment_line
77
77
"#{ @ivar } = #{ @val } " \
78
- " unless #{ @val } == #{ @null } && instance_variable_defined?(:#{ @ivar } )"
78
+ " unless #{ @null } == #{ @val } && instance_variable_defined?(:#{ @ivar } )"
79
79
end
80
80
end
81
81
end
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def method_lines
38
38
return unless @null
39
39
[
40
40
"def #{ @target } " ,
41
- " #{ @ivar } unless #{ @ivar } == Dry::Initializer::UNDEFINED" ,
41
+ " #{ @ivar } unless Dry::Initializer::UNDEFINED == #{ @ivar } " ,
42
42
"end"
43
43
]
44
44
end
You can’t perform that action at this time.
0 commit comments