lib/teacup/calculations.rb in teacup-2.1.10 vs lib/teacup/calculations.rb in teacup-2.1.11
- old
+ new
@@ -3,11 +3,11 @@
def calculate(view, dimension, amount)
if amount.is_a? Proc
view.instance_exec(&amount)
elsif amount.is_a?(String) && amount.include?('%')
location = amount.index '%'
- offset = amount[(location+1)..-1].gsub(' ', '').to_f
- percent = amount[0...location].to_f / 100.0
+ offset = amount.slice(location+1, amount.size).gsub(' ', '').to_f
+ percent = amount.slice(0, location).to_f / 100.0
case dimension
when :width
view.superview.bounds.size.width * percent + offset
when :height