Class: Link
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Link
- Includes:
- SocialStream::Models::Object
- Defined in:
- app/models/link.rb
Instance Attribute Summary collapse
-
#loaded ⇒ Object
Returns the value of attribute loaded.
Instance Method Summary collapse
Instance Attribute Details
#loaded ⇒ Object
Returns the value of attribute loaded.
6 7 8 |
# File 'app/models/link.rb', line 6 def loaded @loaded end |
Instance Method Details
#check_loaded ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/models/link.rb', line 35 def check_loaded if !self.loaded.eql? "true" and self.title.nil? and self.description.nil? and self.image.nil? begin o = Linkser.parse self.url, {:max_images => 1} if o.is_a? Linkser::Objects::HTML self.fill o end rescue end end end |
#fill(linkser_object) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/link.rb', line 18 def fill linkser_object self.title = linkser_object.title if linkser_object.title self.description = linkser_object.description if linkser_object.description self.url = linkser_object.last_url r = linkser_object.resource if r and r.type and r.url self.callback_url = r.url end self.width = r.width if r and r.width self.height = r.height if r and r.height if linkser_object.ogp and linkser_object.ogp.image self.image = linkser_object.ogp.image elsif linkser_object.images and linkser_object.images.first self.image = linkser_object.images.first.url end end |