def alternative_sizes image, sizes
      data_sizes = {}
      sizes[:sizes].each do |size, value|
        if value.present?
          data_sizes["data-#{size}-src"] = (value == :default ? image.url : image.send(value))
        else
          false
        end
      end
      data_sizes
    end
def alternative_sizes image, sizes
      data_sizes = {}
      sizes[:sizes].each do |size, value|
        if value.present?
          data_sizes["data-#{size}-src"] = (value == :default ? image.url : image.send(value))
        else
          false
        end
      end
      data_sizes
    end
def alternative_sizes image , sizes data_sizes = { } sizes [ :sizes ] . each do | size , value | if value . present? data_sizes [ "data-#{size}-src" ] = ( value == :default ? image . url : image . send ( value ) ) else false end end data_sizes end
Loop over the images sizes and create our data attributes hash
Loop over the images sizes and create our data attributes hash