cirandas.net

ref: master

app/concerns/maybe_add_http.rb


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
module MaybeAddHttp

  def maybe_add_http(value)
    return '' if value.blank?
    if value =~ /https?:\/\//
      value
    else
      'http://' + value
    end
  end

end