Class: RichSnippet::Thing
- Inherits:
-
Obj
- Object
- Obj
- RichSnippet::Thing
show all
- Defined in:
- app/models/rich_snippet/thing.rb
Instance Method Summary
collapse
Instance Method Details
#array_json(attribute) ⇒ Object
20
21
22
23
24
25
26
|
# File 'app/models/rich_snippet/thing.rb', line 20
def array_json(attribute)
o = []
attribute.each do |elem|
o << elem.to_json
end
return o
end
|
#module ⇒ Object
12
13
14
|
# File 'app/models/rich_snippet/thing.rb', line 12
def module
self.class.name.demodulize.downcase
end
|
#name ⇒ Object
8
9
10
|
# File 'app/models/rich_snippet/thing.rb', line 8
def name
self.title
end
|
#to_json(render_childs = false) ⇒ Object
28
29
30
31
32
33
34
35
36
37
|
# File 'app/models/rich_snippet/thing.rb', line 28
def to_json(render_childs = false)
{
"@context": "http://schema.org",
"@type": "Thing",
name: name,
description: description,
image: image ? image.binary_url : '',
url: url
}.delete_if { |k, v| !v.present? }
end
|
#type ⇒ Object
16
17
18
|
# File 'app/models/rich_snippet/thing.rb', line 16
def type
self.class.name.underscore
end
|
#warnings ⇒ Object
39
40
41
|
# File 'app/models/rich_snippet/thing.rb', line 39
def warnings
[]
end
|