class Object
Public Instance Methods
autoscale(str_array)
click to toggle source
Option 3: Mapping to ranges in your code #
Here’s an in-between option that allows you to programmatically apply font sizes. This allows you a ton of flexibility.Probably more flexibility than you need, frankly. But one advantage is that you don’t have to set the height
# File samples/autoscale_font/_autoscale_font.rb, line 72 def autoscale(str_array) str_array.map do | str | case str.length when 0..15 9 when 16..20 6 else 4 end end end