Module: Cortex::Snippets::Client::Helper

Defined in:
lib/cortex/snippets/client/helper.rb

Instance Method Summary collapse

Instance Method Details

#dynamic_yieldObject



63
64
65
66
67
68
# File 'lib/cortex/snippets/client/helper.rb', line 63

def dynamic_yield
  {
      sku: webpage[:dynamic_yield_sku],
      category: webpage[:dynamic_yield_category]
  }
end

#noarchiveObject



55
56
57
# File 'lib/cortex/snippets/client/helper.rb', line 55

def noarchive
  webpage[:noarchive]
end

#nofollowObject



43
44
45
# File 'lib/cortex/snippets/client/helper.rb', line 43

def nofollow
  webpage[:nofollow]
end

#noimageindexObject



59
60
61
# File 'lib/cortex/snippets/client/helper.rb', line 59

def noimageindex
  webpage[:noimageindex]
end

#noindexObject



39
40
41
# File 'lib/cortex/snippets/client/helper.rb', line 39

def noindex
  webpage[:noindex]
end

#noodpObject



47
48
49
# File 'lib/cortex/snippets/client/helper.rb', line 47

def noodp
  webpage[:noodp]
end

#nosnippetObject



51
52
53
# File 'lib/cortex/snippets/client/helper.rb', line 51

def nosnippet
  webpage[:nosnippet]
end

#seo_descriptionObject



20
21
22
# File 'lib/cortex/snippets/client/helper.rb', line 20

def seo_description
  webpage[:seo_description]
end

#seo_keywordsObject



24
25
26
# File 'lib/cortex/snippets/client/helper.rb', line 24

def seo_keywords
  webpage[:seo_keyword_list]
end

#seo_robotsObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/cortex/snippets/client/helper.rb', line 28

def seo_robots
  robot_information = []
  index_options = [:noindex, :nofollow, :noodp, :nosnippet, :noarchive, :noimageindex]

  index_options.each do |index_option|
    robot_information << index_option if webpage[index_option]
  end

  robot_information
end

#seo_titleObject



16
17
18
# File 'lib/cortex/snippets/client/helper.rb', line 16

def seo_title
  webpage[:seo_title]
end

#snippet(options = {}, &block) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/cortex/snippets/client/helper.rb', line 5

def snippet(options = {}, &block)
  snippets = webpage[:snippets] || []
  snippet = snippets.find { |snippet| snippet[:document][:name] == options[:id] }

  if snippet.nil? || snippet[:document][:body].nil? || snippet[:document][:body].empty?
    (:snippet, capture(&block), options)
  else
    (:snippet, snippet[:document][:body].html_safe, options)
  end
end