module SocialUrl

Constants

VERSION

Public Class Methods

networks() click to toggle source
# File lib/social_url.rb, line 20
def networks
  NETWORKS
end
normalize(params) click to toggle source
# File lib/social_url.rb, line 24
def normalize(params)
  params.map do |key, value|
    if key == :hashtags
      [key, normalize_hashtags(value)]
    elsif value.is_a?(String)
      [key, normalize_string(value)]
    elsif value.is_a?(Array)
      [key, normalize_array(value)]
    end
  end.to_h
end
normalize_array(array) click to toggle source
# File lib/social_url.rb, line 46
def normalize_array(array)
  array.collect do |value|
    ERB::Util.url_encode(value)
  end.join(",")
end
normalize_hashtags(array) click to toggle source
# File lib/social_url.rb, line 36
def normalize_hashtags(array)
  array.collect do |value|
    value.delete(" ")
  end.join(",")
end
normalize_string(string) click to toggle source
# File lib/social_url.rb, line 42
def normalize_string(string)
  ERB::Util.url_encode(string)
end