Class: Smithy::PageProxy

Inherits:
Object
  • Object
show all
Defined in:
app/models/smithy/page_proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ PageProxy

Returns a new instance of PageProxy.



26
27
28
29
30
31
# File 'app/models/smithy/page_proxy.rb', line 26

def initialize(attributes = {})
  @containers = {}
  [:id, :browser_title, :title, :path, :keywords, :description].each do |k|
    self.send("#{k}=".to_sym, attributes[k]) if attributes[k].present?
  end
end

Instance Attribute Details

#browser_titleObject

Returns the value of attribute browser_title.



24
25
26
# File 'app/models/smithy/page_proxy.rb', line 24

def browser_title
  @browser_title
end

#descriptionObject

Returns the value of attribute description.



24
25
26
# File 'app/models/smithy/page_proxy.rb', line 24

def description
  @description
end

#idObject

Returns the value of attribute id.



24
25
26
# File 'app/models/smithy/page_proxy.rb', line 24

def id
  @id
end

#keywordsObject

Returns the value of attribute keywords.



24
25
26
# File 'app/models/smithy/page_proxy.rb', line 24

def keywords
  @keywords
end

#pathObject

Returns the value of attribute path.



24
25
26
# File 'app/models/smithy/page_proxy.rb', line 24

def path
  @path
end

#titleObject

Returns the value of attribute title.



24
25
26
# File 'app/models/smithy/page_proxy.rb', line 24

def title
  @title
end

Instance Method Details

#add_to_container(container_name, content) ⇒ Object



41
42
43
44
45
# File 'app/models/smithy/page_proxy.rb', line 41

def add_to_container(container_name, content)
  @containers[container_name.to_s] ||= ''
  @containers[container_name.to_s] << content
  @containers
end

#containersObject



37
38
39
# File 'app/models/smithy/page_proxy.rb', line 37

def containers
  @containers
end

#siteObject



47
48
49
# File 'app/models/smithy/page_proxy.rb', line 47

def site
  @site ||= Smithy::Site.instance
end

#to_liquidObject



51
52
53
54
55
56
57
58
59
60
61
# File 'app/models/smithy/page_proxy.rb', line 51

def to_liquid
  {
    'id' => self.id,
    'browser_title' => (self.browser_title.present? ? self.browser_title : self.title),
    'title' => title,
    'path' => path,
    'meta_description' => description,
    'meta_keywords' => keywords,
    'container' => containers
  }
end