lib/shoes/swt/text_block/fitter.rb in shoes-swt-4.0.0.pre10 vs lib/shoes/swt/text_block/fitter.rb in shoes-swt-4.0.0.pre11
- old
+ new
@@ -149,21 +149,21 @@
height = :unbounded
# Try to find a parent container we fit in.
# If that doesn't work, just bail with [0,0] so we don't crash.
width = width_from_ancestor if width <= 0
- return [0, 0] if width < 0
+ return [0, 0] if width.negative?
end
[width, height]
end
# If we're positioned outside our containing width, look up the parent
# chain until we find a width that accomodates us.
def width_from_ancestor
width = -1
current_ancestor = @dsl.parent
- until width > 0 || current_ancestor.nil?
+ until width.positive? || current_ancestor.nil?
width = @dsl.desired_width(current_ancestor.width)
break unless current_ancestor.respond_to?(:parent)
current_ancestor = current_ancestor.parent
end