class Layouter::Leaf::Spacer
Attributes
max_height[RW]
max_width[RW]
min_height[RW]
min_width[RW]
Public Class Methods
new(weight: 1)
click to toggle source
Calls superclass method
Layouter::Leaf::Base::new
# File lib/layouter/leaf/spacer.rb, line 7 def initialize(weight: 1) unless weight.is_a?(Numeric) raise(ArgumentError, "Weight must be a number") end raise(ArgumentError, "Weight must more than 1") if weight < 1 super(importance: EPS * weight) @min_width = @min_height = 0 @max_width = @max_height = INF end
Public Instance Methods
render()
click to toggle source
# File lib/layouter/leaf/spacer.rb, line 17 def render layout! ([" " * @calculated_width] * @calculated_height).join("\n") end