Module: ShareChecker::Providers

Defined in:
lib/share_checker.rb,
lib/share_checker/providers/twitter.rb,
lib/share_checker/providers/facebook.rb,
lib/share_checker/providers/vkontakte.rb,
lib/share_checker/providers/tweetracker.rb,
lib/share_checker/providers/odnoklassniki.rb

Defined Under Namespace

Classes: Facebook, Odnoklassniki, Tweetracker, Twitter, Vkontakte

Class Method Summary collapse

Class Method Details

.avariableObject



28
29
30
# File 'lib/share_checker.rb', line 28

def self.avariable
  constants.select {|c| Class === const_get(c)}.sort.map(&:downcase).map(&:to_sym)
end

.get(provider) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/share_checker.rb', line 16

def self.get(provider)
  case provider.to_s.downcase
    when "facebook" then ShareChecker::Providers::Facebook
    when "twitter" then ShareChecker::Providers::Twitter
    when "vkontakte" then ShareChecker::Providers::Vkontakte
    when "odnoklassniki" then ShareChecker::Providers::Odnoklassniki
    when "tweetracker" then ShareChecker::Providers::Tweetracker
    else
      "ShareChecker::Providers::#{provider.to_s.classify}".constantize
  end
end