Class: OpenGraphPlus::Namespace::OG

Inherits:
Base
  • Object
show all
Defined in:
lib/opengraphplus/namespace.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#each, #render_in, #tag, #update

Constructor Details

#initializeOG

Returns a new instance of OG.



85
86
87
# File 'lib/opengraphplus/namespace.rb', line 85

def initialize
  @type = "website"
end

Instance Attribute Details

#audioObject

Returns the value of attribute audio.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def audio
  @audio
end

#descriptionObject

Returns the value of attribute description.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def description
  @description
end

#determinerObject

Returns the value of attribute determiner.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def determiner
  @determiner
end

#localeObject

Returns the value of attribute locale.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def locale
  @locale
end

#site_nameObject

Returns the value of attribute site_name.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def site_name
  @site_name
end

#titleObject

Returns the value of attribute title.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def title
  @title
end

#typeObject

Returns the value of attribute type.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def type
  @type
end

#urlObject

Returns the value of attribute url.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def url
  @url
end

#videoObject

Returns the value of attribute video.



83
84
85
# File 'lib/opengraphplus/namespace.rb', line 83

def video
  @video
end

Instance Method Details

#imageObject



89
90
91
# File 'lib/opengraphplus/namespace.rb', line 89

def image
  @image ||= Image.new
end

#image_url=(url) ⇒ Object



97
98
99
100
# File 'lib/opengraphplus/namespace.rb', line 97

def image_url=(url)
  image.url = url
  image.secure_url = url
end

#plusObject



93
94
95
# File 'lib/opengraphplus/namespace.rb', line 93

def plus
  @plus ||= Plus.new
end

#tagsObject



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/opengraphplus/namespace.rb', line 102

def tags
  [
    tag("og:title", title),
    tag("og:description", description),
    tag("og:url", url),
    tag("og:type", type),
    tag("og:site_name", site_name),
    tag("og:locale", locale),
    tag("og:determiner", determiner),
    tag("og:audio", audio),
    tag("og:video", video),
    *image.tags,
    *plus.tags
  ].compact
end