# File lib/scruffy/helpers/marker_helper.rb, line 5 def each_marker(markers, min, max, width, options, format_key) all_values = [] (0...markers).each do |idx| percent = idx.to_f / (markers-1) all_values << min + (max - min) * percent end all_values.size.times do |idx| dx = width/(markers - 1) location = idx.to_f * dx #+ dx/2 marker_value = all_values[idx] marker_value = options[format_key].route_format(marker_value, idx, options.merge({:all_values => all_values})) if options[format_key] yield marker_value, location end end