Class: Ogo::Opengraph
- Inherits:
-
Object
- Object
- Ogo::Opengraph
- Defined in:
- lib/ogo/opengraph.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#charset ⇒ Object
Returns the value of attribute charset.
-
#description ⇒ Object
Returns the value of attribute description.
-
#error ⇒ Object
Returns the value of attribute error.
-
#images ⇒ Object
Returns the value of attribute images.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#original_images ⇒ Object
Returns the value of attribute original_images.
-
#response ⇒ Object
Returns the value of attribute response.
-
#src ⇒ Object
Returns the value of attribute src.
-
#title ⇒ Object
Returns the value of attribute title.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(src, options = {}) ⇒ Opengraph
constructor
A new instance of Opengraph.
- #inspect ⇒ Object
- #parse ⇒ Object
- #parse! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(src, options = {}) ⇒ Opengraph
Returns a new instance of Opengraph.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ogo/opengraph.rb', line 8 def initialize(src, = {}) @src = src @body = nil @images = [] = {} @charset = 'utf-8' @error = nil @_fallback = [:fallback] || true = end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def body @body end |
#charset ⇒ Object
Returns the value of attribute charset.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def charset @charset end |
#description ⇒ Object
Returns the value of attribute description.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def description @description end |
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def error @error end |
#images ⇒ Object
Returns the value of attribute images.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def images @images end |
#metadata ⇒ Object
Returns the value of attribute metadata.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def end |
#original_images ⇒ Object
Returns the value of attribute original_images.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def original_images @original_images end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def response @response end |
#src ⇒ Object
Returns the value of attribute src.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def src @src end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/ogo/opengraph.rb', line 4 def url @url end |
Instance Method Details
#inspect ⇒ Object
32 33 34 35 36 |
# File 'lib/ogo/opengraph.rb', line 32 def inspect str = "<Ogo::Opengraph:0x00#{'%x' % (self.object_id << 1)}\nurl=\"#{url}\",\nmetadata=#{metadata},\n" str << "images=#{images},\ntype=\"#{type}\",\ntitle=\"#{title}\">" str end |
#parse ⇒ Object
20 21 22 23 24 25 |
# File 'lib/ogo/opengraph.rb', line 20 def parse parse_opengraph() load_fallback if @_fallback check_images_path self end |
#parse! ⇒ Object
27 28 29 30 |
# File 'lib/ogo/opengraph.rb', line 27 def parse! parse error ? raise(error) : self end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/ogo/opengraph.rb', line 38 def to_s inspect end |