Class: Onebox::Preview
- Inherits:
-
Object
- Object
- Onebox::Preview
- Defined in:
- lib/onebox/preview.rb
Defined Under Namespace
Classes: InvalidURI
Instance Attribute Summary collapse
-
#cache ⇒ Object
readonly
Returns the value of attribute cache.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(link, parameters = Onebox.options) ⇒ Preview
constructor
A new instance of Preview.
- #options ⇒ Object
- #placeholder_html ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#cache ⇒ Object (readonly)
Returns the value of attribute cache.
3 4 5 |
# File 'lib/onebox/preview.rb', line 3 def cache @cache end |
Class Method Details
.web_exceptions ⇒ Object
30 31 32 |
# File 'lib/onebox/preview.rb', line 30 def self.web_exceptions [Net::HTTPServerException, OpenURI::HTTPError, Timeout::Error, Net::HTTPError, Errno::ECONNREFUSED] end |
Instance Method Details
#options ⇒ Object
26 27 28 |
# File 'lib/onebox/preview.rb', line 26 def OpenStruct.new(@options) end |
#placeholder_html ⇒ Object
19 20 21 22 23 24 |
# File 'lib/onebox/preview.rb', line 19 def placeholder_html return "" unless engine process_html(engine.placeholder_html) rescue *Onebox::Preview.web_exceptions "" end |
#to_s ⇒ Object
12 13 14 15 16 17 |
# File 'lib/onebox/preview.rb', line 12 def to_s return "" unless engine process_html(engine_html) rescue *Onebox::Preview.web_exceptions "" end |