Class: IdsPlease
- Inherits:
-
Object
- Object
- IdsPlease
- Defined in:
- lib/ids_please.rb,
lib/ids_please/vimeo.rb,
lib/ids_please/tumblr.rb,
lib/ids_please/twitter.rb,
lib/ids_please/youtube.rb,
lib/ids_please/facebook.rb,
lib/ids_please/instagram.rb,
lib/ids_please/vkontakte.rb,
lib/ids_please/soundcloud.rb,
lib/ids_please/base_parser.rb,
lib/ids_please/google_plus.rb,
lib/ids_please/odnoklassniki.rb
Defined Under Namespace
Classes: BaseParser, Facebook, GooglePlus, Instagram, Odnoklassniki, Soundcloud, Tumblr, Twitter, Vimeo, Vkontakte, Youtube
Constant Summary collapse
- VERSION =
'1.0.6'- SOCIAL_NETWORKS =
[ IdsPlease::GooglePlus, IdsPlease::Vkontakte, IdsPlease::Twitter, IdsPlease::Facebook, IdsPlease::Instagram, IdsPlease::Soundcloud, IdsPlease::Vimeo, IdsPlease::Youtube, IdsPlease::Odnoklassniki, IdsPlease::Tumblr ]
Instance Attribute Summary collapse
-
#original ⇒ Object
Returns the value of attribute original.
-
#parsed ⇒ Object
Returns the value of attribute parsed.
-
#recognized ⇒ Object
Returns the value of attribute recognized.
-
#unrecognized ⇒ Object
Returns the value of attribute unrecognized.
Instance Method Summary collapse
-
#initialize(*args) ⇒ IdsPlease
constructor
A new instance of IdsPlease.
- #parse ⇒ Object
- #recognize ⇒ Object
Constructor Details
#initialize(*args) ⇒ IdsPlease
Returns a new instance of IdsPlease.
34 35 36 37 |
# File 'lib/ids_please.rb', line 34 def initialize(*args) duped_args = args.dup @original = duped_args end |
Instance Attribute Details
#original ⇒ Object
Returns the value of attribute original.
19 20 21 |
# File 'lib/ids_please.rb', line 19 def original @original end |
#parsed ⇒ Object
Returns the value of attribute parsed.
19 20 21 |
# File 'lib/ids_please.rb', line 19 def parsed @parsed end |
#recognized ⇒ Object
Returns the value of attribute recognized.
19 20 21 |
# File 'lib/ids_please.rb', line 19 def recognized @recognized end |
#unrecognized ⇒ Object
Returns the value of attribute unrecognized.
19 20 21 |
# File 'lib/ids_please.rb', line 19 def unrecognized @unrecognized end |
Instance Method Details
#parse ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ids_please.rb', line 45 def parse recognize @parsed = {} recognized.each do |network_sym, links| parser = SOCIAL_NETWORKS.find { |sn| sn.to_sym == network_sym } @parsed[network_sym] ||= [] @parsed[network_sym] += parser.parse(links) end end |
#recognize ⇒ Object
39 40 41 42 43 |
# File 'lib/ids_please.rb', line 39 def recognize @recognized = {} @unrecognized = [] original.each { |l| recognize_link(l) } end |