Grid broken if no gutter defined
bvogel opened this issue · 5 comments
The following code block in grid.rb will break if no gutter is defined:
def apply_gutter(options)
if options.key?(:gutter)
@gutter = Float(options[:gutter])
@row_gutter = @gutter
@column_gutter = @gutter
else
@row_gutter = Float(options[:row_gutter])
@column_gutter = Float(options[:column_gutter])
@gutter = 0
end
end
the commit be66ddd replaced options[:row_gutter].to_f
which happily returned 0.0
for nil
values with Float(options[:row_gutter])
which will break with TypeError: can't convert nil into Float
.
(I expect the same to happen in other places where to_f
was replaced with Float()
)
I'd have considered this breaking change that would have merited a mayor version change.
I have hit this bug too...
What should be the fix here? Rechange Float()
with to_f
or check for nil
?
I could submit a PR
We ran into this issue too. It would be nice if it is fixed going forward. It is definitely a breaking change.
@datanoise I second that. It'd be absolutely marvellous if the bug got fixed.
There is a workaround for this with same behaviour. Define the gutter
argument with zero:
before:
define_grid(rows: 1, columns: 2)
after:
define_grid(rows: 1, columns: 2, gutter: 0)
I have already submitted a PR for that.
@datanoise I second that. It'd be absolutely marvellous if the bug got fixed.